diff options
author | Venkata Sidagam <venkata.sidagam@oracle.com> | 2012-11-07 09:03:33 +0530 |
---|---|---|
committer | Venkata Sidagam <venkata.sidagam@oracle.com> | 2012-11-07 09:03:33 +0530 |
commit | 1d771aa4257c76d409c3b65907af518b18127953 (patch) | |
tree | 551e6139282e99b19229164135749d76cce39652 /storage/heap | |
parent | 9e13157b33923b6a68c911685997ebe5530df1da (diff) | |
parent | 2226b1084ce0209ad4ff8e3805ed944600af3abb (diff) | |
download | mariadb-git-1d771aa4257c76d409c3b65907af518b18127953.tar.gz |
Bug #11759445: CAN'T DELETE ROWS FROM MEMORY TABLE WITH HASH KEY.
Merging from 5.1 to 5.5
Diffstat (limited to 'storage/heap')
-rw-r--r-- | storage/heap/hp_delete.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/storage/heap/hp_delete.c b/storage/heap/hp_delete.c index ceba0fcf12e..3090b60d611 100644 --- a/storage/heap/hp_delete.c +++ b/storage/heap/hp_delete.c @@ -104,7 +104,7 @@ int hp_rb_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo, int hp_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo, const uchar *record, uchar *recpos, int flag) { - ulong blength,pos2,pos_hashnr,lastpos_hashnr; + ulong blength, pos2, pos_hashnr, lastpos_hashnr, key_pos; HASH_INFO *lastpos,*gpos,*pos,*pos3,*empty,*last_ptr; HP_SHARE *share=info->s; DBUG_ENTER("hp_delete_key"); @@ -116,9 +116,9 @@ int hp_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo, last_ptr=0; /* Search after record with key */ - pos= hp_find_hash(&keyinfo->block, - hp_mask(hp_rec_hashnr(keyinfo, record), blength, - share->records + 1)); + key_pos= hp_mask(hp_rec_hashnr(keyinfo, record), blength, share->records + 1); + pos= hp_find_hash(&keyinfo->block, key_pos); + gpos = pos3 = 0; while (pos->ptr_to_rec != recpos) @@ -188,6 +188,16 @@ int hp_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo, DBUG_RETURN(0); } pos3= pos; /* Link pos->next after lastpos */ + /* + One of elements from the bucket we're scanning is moved to the + beginning of the list. Reset search since this element may not have + been processed yet. + */ + if (flag && pos2 == key_pos) + { + info->current_ptr= 0; + info->current_hash_ptr= 0; + } } else { |