summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2016-06-01 17:54:23 +0400
committerSergey Vojtovich <svoj@mariadb.org>2016-06-01 17:54:23 +0400
commitd6d40112110e05f62122e90f209f05f273c7e6dc (patch)
tree84410165cc3544bd09d370851e69262646263620
parent41dc2fc1297975b9c4c9e33f58f67ae9b9f5fa83 (diff)
downloadmariadb-git-d6d40112110e05f62122e90f209f05f273c7e6dc.tar.gz
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.
-rw-r--r--sql/table_cache.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/sql/table_cache.cc b/sql/table_cache.cc
index 764d75c2e09..acfd3bd63ab 100644
--- a/sql/table_cache.cc
+++ b/sql/table_cache.cc
@@ -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;