summaryrefslogtreecommitdiff
path: root/mysys/hash.c
diff options
context:
space:
mode:
authorsvoj@june.mysql.com <>2007-07-05 11:47:53 +0500
committersvoj@june.mysql.com <>2007-07-05 11:47:53 +0500
commit00e72528ade651e448b4caf48999fd1cbb6f4d9e (patch)
tree7c3e2661d866d42caad081407740b3cd8a8e8760 /mysys/hash.c
parentdc82068c9696f7da81c60b167b8a68d2c91d8bdb (diff)
parent9b5dace07193b8d6e82e1f0b86bfa4a5ee27d865 (diff)
downloadmariadb-git-00e72528ade651e448b4caf48999fd1cbb6f4d9e.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
Diffstat (limited to 'mysys/hash.c')
-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)