Skip to content

Commit

Permalink
MDEV-25936 Crash during DDL that involves FULLTEXT INDEX
Browse files Browse the repository at this point in the history
In commit 1bd681c we introduced
a work-around for the missing MDL protection when the internal
tables of FULLTEXT INDEX are dropped during DDL operations.
That work-around suffered from a race condition. A purge thread
could have narrowly passed purge_sys.check_stop_FTS() and then
(while holding dict_sys.mutex) acquire a table reference right
after fts_lock_table() determined that no references were being
held.

fts_lock_table(): Protect the reference check with dict_sys.mutex.

Thanks to Thirunarayanan Balathandayuthapani for repeating the
failure and testing the fix.
  • Loading branch information
dr-m committed Jun 16, 2021
1 parent 71964c7 commit da65cb4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions storage/innobase/fts/fts0fts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1549,15 +1549,19 @@ static dberr_t fts_lock_table(trx_t *trx, const char *table_name)
{
dberr_t err= lock_table_for_trx(table, trx, LOCK_X);
/* Wait for purge threads to stop using the table. */
dict_sys.mutex_lock();
for (uint n= 15; table->get_ref_count() > 1; )
{
dict_sys.mutex_unlock();
if (!--n)
{
err= DB_LOCK_WAIT_TIMEOUT;
break;
}
std::this_thread::sleep_for(std::chrono::milliseconds(50));
dict_sys.mutex_lock();
}
dict_sys.mutex_unlock();
table->release();
return err;
}
Expand Down

0 comments on commit da65cb4

Please sign in to comment.