summaryrefslogtreecommitdiff
path: root/sql/table_cache.cc
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2014-03-28 11:30:10 +0400
committerSergey Vojtovich <svoj@mariadb.org>2014-03-28 11:30:10 +0400
commit71064cbe5d2689e339a5499086fe7f9b5f39e0a1 (patch)
tree8b3234fa972ce6bd36d9a1e8b821b7d657236c2c /sql/table_cache.cc
parent68015a99cdd0ffb203e44c10726371af14207073 (diff)
downloadmariadb-git-71064cbe5d2689e339a5499086fe7f9b5f39e0a1.tar.gz
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.
Diffstat (limited to 'sql/table_cache.cc')
-rw-r--r--sql/table_cache.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/sql/table_cache.cc b/sql/table_cache.cc
index af22c67044b..8b768240b4f 100644
--- a/sql/table_cache.cc
+++ b/sql/table_cache.cc
@@ -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;
}