Commit e1ea142c authored by kroki/tomash@moonlight.home's avatar kroki/tomash@moonlight.home

Merge moonlight.home:/home/tomash/src/mysql_ab/mysql-4.0

into  moonlight.home:/home/tomash/src/mysql_ab/mysql-4.0-bug23443
parents ba77051e 5b4d9d87
...@@ -47,7 +47,7 @@ int _hp_get_new_block(HP_BLOCK *block, ulong *alloc_length) ...@@ -47,7 +47,7 @@ int _hp_get_new_block(HP_BLOCK *block, ulong *alloc_length)
break; break;
*alloc_length=sizeof(HP_PTRS)*i+block->records_in_block* block->recbuffer; *alloc_length=sizeof(HP_PTRS)*i+block->records_in_block* block->recbuffer;
if (!(root=(HP_PTRS*) my_malloc(*alloc_length,MYF(0)))) if (!(root=(HP_PTRS*) my_malloc(*alloc_length,MYF(MY_WME))))
return 1; return 1;
if (i == 0) if (i == 0)
......
...@@ -66,13 +66,22 @@ int heap_write(HP_INFO *info, const byte *record) ...@@ -66,13 +66,22 @@ int heap_write(HP_INFO *info, const byte *record)
DBUG_RETURN(0); DBUG_RETURN(0);
err: err:
if (my_errno == HA_ERR_FOUND_DUPP_KEY)
DBUG_PRINT("info",("Duplicate key: %d",key)); DBUG_PRINT("info",("Duplicate key: %d",key));
info->errkey= key; info->errkey= key;
do /*
Because 'key' is unsigned, we increase it before the loop, unless
we have to skip the key that wasn't inserted yet due to OOM. In
the loop we test 'key' before decreasing it as the protection
against value wraparound.
*/
if (my_errno != ENOMEM)
key++;
while (key-- > 0)
{ {
if (_hp_delete_key(info,share->keydef+key,record,pos,0)) if (_hp_delete_key(info,share->keydef+key,record,pos,0))
break; break;
} while (key-- > 0); }
share->deleted++; share->deleted++;
*((byte**) pos)=share->del_link; *((byte**) pos)=share->del_link;
......
...@@ -1892,8 +1892,9 @@ bool Item_func_set_user_var::update_hash(const void *ptr, uint length, ...@@ -1892,8 +1892,9 @@ bool Item_func_set_user_var::update_hash(const void *ptr, uint length,
char *pos= (char*) entry+ ALIGN_SIZE(sizeof(user_var_entry)); char *pos= (char*) entry+ ALIGN_SIZE(sizeof(user_var_entry));
if (entry->value == pos) if (entry->value == pos)
entry->value=0; entry->value=0;
if (!(entry->value=(char*) my_realloc(entry->value, length, entry->value= (char*) my_realloc(entry->value, length,
MYF(MY_ALLOW_ZERO_PTR)))) MYF(MY_ALLOW_ZERO_PTR | MY_WME));
if (!entry->value)
goto err; goto err;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment