summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantony@ppcg5.local <>2007-07-06 08:57:18 -0700
committerantony@ppcg5.local <>2007-07-06 08:57:18 -0700
commitbab42982bcc36b6a32bb13714d101512a0c949dc (patch)
treecb7b59ce07267b01ea53ddeb59e60c1e8b51b478
parentf8bf427ba41df2aa4b19667e7b8c2d64a85b6074 (diff)
parentc2120c40eea8a66874c1e9b4e38598c3faaebf19 (diff)
downloadmariadb-git-bab42982bcc36b6a32bb13714d101512a0c949dc.tar.gz
Merge anubis.xiphis.org:/usr/home/antony/work/mysql-4.1-engines
into anubis.xiphis.org:/usr/home/antony/work/mysql-4.1-engines.merge
-rw-r--r--mysys/hash.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/mysys/hash.c b/mysys/hash.c
index 75135a470c9..1ba80dc6fd3 100644
--- a/mysys/hash.c
+++ b/mysys/hash.c
@@ -572,6 +572,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)