Merge 10.5 into 10.6

This commit is contained in:
Marko Mäkelä 2025-01-20 09:57:37 +02:00
commit 98dbe3bfaf
142 changed files with 3641 additions and 827 deletions

View file

@ -46,7 +46,7 @@ int heap_rnext(HP_INFO *info, uchar *record)
&info->last_pos, offsetof(TREE_ELEMENT, left));
}
}
else if (info->last_pos)
else if (info->last_pos && info->key_version == info->s->key_version)
{
/*
We enter this branch for non-DELETE queries after heap_rkey()
@ -72,6 +72,7 @@ int heap_rnext(HP_INFO *info, uchar *record)
*/
pos= tree_search_edge(&keyinfo->rb_tree, info->parents,
&info->last_pos, offsetof(TREE_ELEMENT, left));
info->key_version= info->s->key_version;
}
else
{
@ -87,6 +88,7 @@ int heap_rnext(HP_INFO *info, uchar *record)
info->last_find_flag= HA_READ_KEY_OR_NEXT;
pos = tree_search_key(&keyinfo->rb_tree, info->lastkey, info->parents,
&info->last_pos, info->last_find_flag, &custom_arg);
info->key_version= info->s->key_version;
}
if (pos)
{

View file

@ -46,7 +46,7 @@ int heap_rprev(HP_INFO *info, uchar *record)
&info->last_pos, offsetof(TREE_ELEMENT, right));
}
}
else if (info->last_pos)
else if (info->last_pos && info->key_version == info->s->key_version)
pos = tree_search_next(&keyinfo->rb_tree, &info->last_pos,
offsetof(TREE_ELEMENT, right),
offsetof(TREE_ELEMENT, left));
@ -58,6 +58,7 @@ int heap_rprev(HP_INFO *info, uchar *record)
info->last_find_flag= HA_READ_KEY_OR_PREV;
pos = tree_search_key(&keyinfo->rb_tree, info->lastkey, info->parents,
&info->last_pos, info->last_find_flag, &custom_arg);
info->key_version= info->s->key_version;
}
if (pos)
{

View file

@ -21,7 +21,8 @@
int heap_update(HP_INFO *info, const uchar *old, const uchar *heap_new)
{
HP_KEYDEF *keydef, *end, *p_lastinx;
uchar *pos;
uchar *pos, *recovery_ptr;
struct st_hp_hash_info *recovery_hash_ptr;
my_bool auto_key_changed= 0, key_changed= 0;
HP_SHARE *share= info->s;
DBUG_ENTER("heap_update");
@ -34,6 +35,10 @@ int heap_update(HP_INFO *info, const uchar *old, const uchar *heap_new)
if (--(share->records) < share->blength >> 1) share->blength>>= 1;
share->changed=1;
// Save the cursor position to recover if insert fails.
recovery_ptr= info->current_ptr;
recovery_hash_ptr= info->current_hash_ptr;
p_lastinx= share->keydef + info->lastinx;
for (keydef= share->keydef, end= keydef + share->keys; keydef < end; keydef++)
{
@ -84,6 +89,8 @@ int heap_update(HP_INFO *info, const uchar *old, const uchar *heap_new)
}
keydef--;
}
info->current_ptr= recovery_ptr;
info->current_hash_ptr= recovery_hash_ptr;
}
if (++(share->records) == share->blength)
share->blength+= share->blength;