Commit 71064cbe authored by Sergey Vojtovich's avatar Sergey Vojtovich

MDEV-5964 - main.mdev-504 unveils assertion failure in

            TABLE_SHARE::visit_subgraph

tc_acquire_table() is not ready to update TABLE::in_use without mutex:
thr1: table= free_tables.pop_front(); // table->in_use is 0
thr2: tdc_remove_table();
thr2: find_deadlock(); // assert(table->in_use != 0)
thr1: table->in_use= thd;

Protect update of TABLE::in_use by LOCK_table_share.
parent 68015a99
......@@ -332,8 +332,6 @@ static TABLE *tc_acquire_table(THD *thd, TABLE_SHARE *share)
mysql_mutex_lock(&share->tdc.LOCK_table_share);
table= share->tdc.free_tables.pop_front();
mysql_mutex_unlock(&share->tdc.LOCK_table_share);
if (table)
{
DBUG_ASSERT(!table->in_use);
......@@ -343,6 +341,7 @@ static TABLE *tc_acquire_table(THD *thd, TABLE_SHARE *share)
/* The children must be detached from the table. */
DBUG_ASSERT(!table->file->extra(HA_EXTRA_IS_ATTACHED_CHILDREN));
}
mysql_mutex_unlock(&share->tdc.LOCK_table_share);
return table;
}
......
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