summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <svoj@june.mysql.com>2007-07-05 11:47:53 +0500
committerunknown <svoj@june.mysql.com>2007-07-05 11:47:53 +0500
commit4beb79a46e4f0b142c442a53e5831fdb1cca3da1 (patch)
tree7c3e2661d866d42caad081407740b3cd8a8e8760 /mysys
parent435df1859fc503c884cdec9eaceb7f5f102af70d (diff)
parentdc308c51470b529eb0e9d05bbab9ef88b7cff493 (diff)
downloadmariadb-git-4beb79a46e4f0b142c442a53e5831fdb1cca3da1.tar.gz
Merge mysql.com:/home/svoj/devel/mysql/BUG27564/mysql-5.0-engines
into mysql.com:/home/svoj/devel/mysql/BUG27564/mysql-5.1-engines mysys/hash.c: Auto merged
Diffstat (limited to 'mysys')
-rw-r--r--mysys/hash.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/mysys/hash.c b/mysys/hash.c
index d8c914d13dd..47ddc5aa97d 100644
--- a/mysys/hash.c
+++ b/mysys/hash.c
@@ -593,6 +593,25 @@ my_bool hash_update(HASH *hash, uchar *record, uchar *old_key,
previous->next=pos->next; /* unlink pos */
/* Move data to correct position */
+ if (new_index == empty)
+ {
+ /*
+ At this point record is unlinked from the old chain, thus it holds
+ random position. By the chance this position is equal to position
+ for the first element in the new chain. That means updated record
+ is the only record in the new chain.
+ */
+ if (empty != idx)
+ {
+ /*
+ Record was moved while unlinking it from the old chain.
+ Copy data to a new position.
+ */
+ data[empty]= org_link;
+ }
+ data[empty].next= NO_RECORD;
+ DBUG_RETURN(0);
+ }
pos=data+new_index;
new_pos_index=hash_rec_mask(hash,pos,blength,records);
if (new_index != new_pos_index)