summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <svoj@june.mysql.com>2007-07-05 11:45:58 +0500
committerunknown <svoj@june.mysql.com>2007-07-05 11:45:58 +0500
commitdc308c51470b529eb0e9d05bbab9ef88b7cff493 (patch)
tree659bee7e1f6b53b1167ffc90c2ae7b96b761c799 /mysys
parenta9b675e200673bb2bd6d28dcc64b6abe92c0a3db (diff)
parentb7bf9725852640bf843a5bd5fc83d6a0556406de (diff)
downloadmariadb-git-dc308c51470b529eb0e9d05bbab9ef88b7cff493.tar.gz
Merge mysql.com:/home/svoj/devel/mysql/BUG27564/mysql-4.1-engines
into mysql.com:/home/svoj/devel/mysql/BUG27564/mysql-5.0-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 0c949b3a0d8..9e8404248eb 100644
--- a/mysys/hash.c
+++ b/mysys/hash.c
@@ -570,6 +570,25 @@ my_bool hash_update(HASH *hash,byte *record,byte *old_key,uint old_key_length)
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)