summaryrefslogtreecommitdiff
path: root/sql/table_cache.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2021-04-29 21:08:32 +0300
committerSergei Golubchik <serg@mariadb.org>2021-05-19 22:54:14 +0200
commit744a53806e9d4e2f31671e361e481308dec1545d (patch)
tree410365ede86c6c450ab4d3162acfc9360729d7d3 /sql/table_cache.cc
parent0b59320d3d2960355ae4afb3a434a5c81c063e12 (diff)
downloadmariadb-git-744a53806e9d4e2f31671e361e481308dec1545d.tar.gz
Fixed hang in concurrent DROP TABLE and BACKUP LOCK BLOCK_DDL
The problem was that tdc_remove_referenced_share() did not take into account that someone could push things into share->free_tables() even if there is a MDL_EXCLUSIVE lock on the table. This can happen if flush_tables() uses the table cache to flush a a non transactional table to disk.
Diffstat (limited to 'sql/table_cache.cc')
-rw-r--r--sql/table_cache.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/table_cache.cc b/sql/table_cache.cc
index 62ccfba7e7d..2e9fb34c17e 100644
--- a/sql/table_cache.cc
+++ b/sql/table_cache.cc
@@ -1001,8 +1001,9 @@ void tdc_remove_referenced_share(THD *thd, TABLE_SHARE *share)
DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, share->db.str,
share->table_name.str,
MDL_EXCLUSIVE));
- share->tdc->flush_unused(false);
+ share->tdc->flush_unused(true);
mysql_mutex_lock(&share->tdc->LOCK_table_share);
+ DEBUG_SYNC(thd, "before_wait_for_refs");
share->tdc->wait_for_refs(1);
DBUG_ASSERT(share->tdc->all_tables.is_empty());
share->tdc->ref_count--;