From 255313048ca00c48fe78250014570034475a9178 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Mon, 16 Aug 2021 17:02:15 +0530 Subject: MDEV-26273 InnoDB FTS DDL fails when innodb_force_recovery is set to 2 InnoDB DDL fails when it tries to sync the table when innodb_force_recovery is set to 2. Problem is that fts_optimize_wq is not initialized when there are no background threads. fts_sync_during_ddl() should check whether fts_optimize_wq is initialized. --- mysql-test/suite/innodb_fts/r/sync.result | 10 ++++++++++ mysql-test/suite/innodb_fts/t/sync.test | 14 ++++++++++++++ storage/innobase/fts/fts0opt.cc | 2 ++ 3 files changed, 26 insertions(+) diff --git a/mysql-test/suite/innodb_fts/r/sync.result b/mysql-test/suite/innodb_fts/r/sync.result index 5b8e4810028..861408cbe2d 100644 --- a/mysql-test/suite/innodb_fts/r/sync.result +++ b/mysql-test/suite/innodb_fts/r/sync.result @@ -145,3 +145,13 @@ id title 2 database 3 good DROP TABLE t1; +# +# MDEV-26273 InnoDB fts DDL fails when +# innodb_force_recovery is set to 2 +# +# restart: --innodb_force_recovery=2 +CREATE TABLE t1 (FTS_DOC_ID BIGINT UNSIGNED KEY, +f1 CHAR(200)) ENGINE=InnoDB; +ALTER TABLE t1 ADD FULLTEXT INDEX(f1); +DROP TABLE t1; +# restart diff --git a/mysql-test/suite/innodb_fts/t/sync.test b/mysql-test/suite/innodb_fts/t/sync.test index 6929dce31b8..f16953ba09f 100644 --- a/mysql-test/suite/innodb_fts/t/sync.test +++ b/mysql-test/suite/innodb_fts/t/sync.test @@ -170,3 +170,17 @@ SET GLOBAL innodb_ft_aux_table=default; SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database good'); DROP TABLE t1; + +--echo # +--echo # MDEV-26273 InnoDB fts DDL fails when +--echo # innodb_force_recovery is set to 2 +--echo # + +let $restart_parameters=--innodb_force_recovery=2; +--source include/restart_mysqld.inc +CREATE TABLE t1 (FTS_DOC_ID BIGINT UNSIGNED KEY, + f1 CHAR(200)) ENGINE=InnoDB; +ALTER TABLE t1 ADD FULLTEXT INDEX(f1); +DROP TABLE t1; +let $restart_parameters=; +--source include/restart_mysqld.inc diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc index e3c0f8f56e4..df10cf63f36 100644 --- a/storage/innobase/fts/fts0opt.cc +++ b/storage/innobase/fts/fts0opt.cc @@ -3037,6 +3037,8 @@ fts_optimize_shutdown() @param[in] table table to be synced */ void fts_sync_during_ddl(dict_table_t* table) { + if (!fts_optimize_wq) + return; mutex_enter(&fts_optimize_wq->mutex); if (!table->fts->sync_message) { -- cgit v1.2.1