From 445f820b610c614074ea15576f36067cb3371036 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Fri, 2 Oct 2020 10:00:59 +0530 Subject: MDEV-21329 InnoDB: Failing assertion: lock->lock_word.load(std::memory_order_relaxed) == X_LOCK_DECR upon server shutdown Problem is that dropping of fts table and sync of fts table happens concurrently during fts optimize thread shutdown. fts_optimize_remove_table() doesn't remove the table from the queue and it leads to above scenario. While removing the table from fts_optimize_wq, if the table can't be removed then wait till fts_optimize_thread shuts down. --- storage/innobase/fts/fts0opt.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc index 8ad1cf4ebe1..3cabb64b851 100644 --- a/storage/innobase/fts/fts0opt.cc +++ b/storage/innobase/fts/fts0opt.cc @@ -2573,6 +2573,11 @@ fts_optimize_remove_table( if (fts_opt_start_shutdown) { ib::info() << "Try to remove table " << table->name << " after FTS optimize thread exiting."; + /* If the table can't be removed then wait till + fts optimize thread shuts down */ + while (fts_optimize_wq) { + os_thread_sleep(10000); + } return; } -- cgit v1.2.1