diff options
-rw-r--r-- | mysql-test/suite/innodb_fts/r/misc_debug.result | 9 | ||||
-rw-r--r-- | mysql-test/suite/innodb_fts/t/misc_debug.test | 13 | ||||
-rw-r--r-- | storage/innobase/fts/fts0opt.cc | 2 | ||||
-rw-r--r-- | storage/innobase/row/row0mysql.cc | 5 |
4 files changed, 27 insertions, 2 deletions
diff --git a/mysql-test/suite/innodb_fts/r/misc_debug.result b/mysql-test/suite/innodb_fts/r/misc_debug.result index 1fcc89b165b..8ef2ac425fc 100644 --- a/mysql-test/suite/innodb_fts/r/misc_debug.result +++ b/mysql-test/suite/innodb_fts/r/misc_debug.result @@ -17,3 +17,12 @@ ALTER TABLE t ADD FULLTEXT INDEX (b(64)); ERROR HY000: Unknown error SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE t; +CREATE TABLE t1 (pk INT, a VARCHAR(8), PRIMARY KEY(pk), +FULLTEXT KEY(a)) ENGINE=InnoDB; +CREATE TABLE t2 (b INT, FOREIGN KEY(b) REFERENCES t1(pk)) ENGINE=InnoDB; +DROP TABLE t1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails +SET DEBUG_DBUG="+d,fts_instrument_sync"; +INSERT INTO t1 VALUES(1, "mariadb"); +ALTER TABLE t1 FORCE; +DROP TABLE t2, t1; diff --git a/mysql-test/suite/innodb_fts/t/misc_debug.test b/mysql-test/suite/innodb_fts/t/misc_debug.test index 4b32afb848c..aaf628abe6d 100644 --- a/mysql-test/suite/innodb_fts/t/misc_debug.test +++ b/mysql-test/suite/innodb_fts/t/misc_debug.test @@ -39,3 +39,16 @@ ALTER TABLE t ADD FULLTEXT INDEX (b(64)); SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE t; + +# MDEV-21550 Assertion `!table->fts->in_queue' failed in +# fts_optimize_remove_table +CREATE TABLE t1 (pk INT, a VARCHAR(8), PRIMARY KEY(pk), + FULLTEXT KEY(a)) ENGINE=InnoDB; +CREATE TABLE t2 (b INT, FOREIGN KEY(b) REFERENCES t1(pk)) ENGINE=InnoDB; +--error ER_ROW_IS_REFERENCED_2 +DROP TABLE t1; +SET DEBUG_DBUG="+d,fts_instrument_sync"; +INSERT INTO t1 VALUES(1, "mariadb"); +ALTER TABLE t1 FORCE; +# Cleanup +DROP TABLE t2, t1; diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc index 202bd80d20a..deda14fee24 100644 --- a/storage/innobase/fts/fts0opt.cc +++ b/storage/innobase/fts/fts0opt.cc @@ -2645,8 +2645,6 @@ fts_optimize_request_sync_table( ib_wqueue_add(fts_optimize_wq, msg, msg->heap, true); - table->fts->in_queue = true; - mutex_exit(&fts_optimize_wq->mutex); } diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index 708d2724595..0aa05a702f3 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -3806,6 +3806,11 @@ funct_exit: trx_commit_for_mysql(trx); } + /* Add the table to fts queue if drop table fails */ + if (err != DB_SUCCESS && table->fts) { + fts_optimize_add_table(table); + } + row_mysql_unlock_data_dictionary(trx); } |