mirror of
https://github.com/MariaDB/server.git
synced 2026-05-09 16:44:29 +02:00
MDEV-25936 Crash during DDL that involves FULLTEXT INDEX
In commit 1bd681c8b3 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.
This commit is contained in:
parent
71964c76fe
commit
da65cb4d97
1 changed files with 4 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue