Commit afb48787 authored by Sergey Vojtovich's avatar Sergey Vojtovich

MDEV-18783 - Server crash in hp_rb_make_key

In debug build, whenever MEMORY table instance gets closed it performs
consistency check without protection. It may cause server crash if
executed concurrently with DML.

Moved consistency check to ha_heap::external_lock(F_UNLCK), so that it
is protected by THR_LOCK.
parent 20b72a3f
......@@ -453,6 +453,10 @@ int ha_heap::reset_auto_increment(ulonglong value)
int ha_heap::external_lock(THD *thd, int lock_type)
{
#ifndef DBUG_OFF
if (lock_type == F_UNLCK && file->s->changed && heap_check_heap(file, 0))
return HA_ERR_CRASHED;
#endif
return 0; // No external locking
}
......
......@@ -35,12 +35,6 @@ int hp_close(register HP_INFO *info)
{
int error=0;
DBUG_ENTER("hp_close");
#ifndef DBUG_OFF
if (info->s->changed && heap_check_heap(info,0))
{
error=my_errno=HA_ERR_CRASHED;
}
#endif
info->s->changed=0;
if (info->open_list.data)
heap_open_list=list_delete(heap_open_list,&info->open_list);
......
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