List:Internals« Previous MessageNext Message »
From:Michael Widenius Date:December 24 2009 11:18am
Subject:re: mysys/hash.c
View as plain text  
Hi!
>>>>> "Yan" == Yan Yu <yan2yu2@stripped> writes:

Yan> Dear MySQL experts:
Yan>      Thank you so much for your reply to my previous Qs, they are very  
Yan> helpful!
Yan>      Could someone please help me understand function my_hash_insert()  
Yan> in mysys/hash.cc?
Yan> what are lines 352 -429 trying to achieve?  Are they just some  
Yan> optimization to shuffle existing
Yan> hash entries in the table (since the existing hash entries may be in  
Yan> the wrong slot due to chaining
Yan> in the case of hash collision)?

The hash algorithm is based on dynamic hashing without empty slots.
This means that when you insert a new key, in some cases a small set
of old keys needs to be moved to other buckets.  This is what the code
does.

Regards,
Monty
Thread
mysys/hash.cYan Yu24 Dec
  • re: mysys/hash.cMichael Widenius24 Dec