1
0
mirror of https://github.com/MariaDB/server.git synced 2025-05-28 13:01:41 +03:00

Move wait_for_mdl_deadlock_detector() call to tc_remove_table()

As a side effect tc_remove_all_unused_tables() has to call
tc_wait_for_mdl_deadlock_detector() once per TABLE object now, while it called
it only once before. This should be acceptable since actual wait will still be
performed only once. It only adds redundant checks for all_tables_refs.
This commit is contained in:
Sergey Vojtovich 2016-06-01 17:54:23 +04:00
parent 41dc2fc129
commit d6d4011211

View File

@ -160,6 +160,8 @@ static void tc_wait_for_mdl_deadlock_detector(TDC_element *element)
static void tc_remove_table(TABLE *table)
{
mysql_mutex_assert_owner(&table->s->tdc->LOCK_table_share);
tc_wait_for_mdl_deadlock_detector(table->s->tdc);
my_atomic_add32_explicit(&tc_count, -1, MY_MEMORY_ORDER_RELAXED);
table->s->tdc->all_tables.remove(table);
}
@ -171,7 +173,6 @@ static void tc_remove_all_unused_tables(TDC_element *element,
{
TABLE *table;
tc_wait_for_mdl_deadlock_detector(element);
/*
Mark share flushed in order to ensure that it gets
automatically deleted once it is no longer referenced.
@ -317,7 +318,6 @@ void tc_add_table(THD *thd, TABLE *table)
TABLE *entry;
mysql_mutex_lock(&element->LOCK_table_share);
lf_hash_search_unpin(thd->tdc_hash_pins);
tc_wait_for_mdl_deadlock_detector(element);
/*
It may happen that oldest table was acquired meanwhile. In this case
@ -425,7 +425,6 @@ bool tc_release_table(TABLE *table)
return false;
purge:
tc_wait_for_mdl_deadlock_detector(table->s->tdc);
tc_remove_table(table);
mysql_mutex_unlock(&table->s->tdc->LOCK_table_share);
table->in_use= 0;