summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2021-08-16 17:02:15 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2021-08-16 17:02:55 +0530
commit255313048ca00c48fe78250014570034475a9178 (patch)
tree371b79674e7cabea415d52cd944400a098e94724
parent3d16e0e16c649505f06b39b7f7e800494ba0fef9 (diff)
downloadmariadb-git-255313048ca00c48fe78250014570034475a9178.tar.gz
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.
-rw-r--r--mysql-test/suite/innodb_fts/r/sync.result10
-rw-r--r--mysql-test/suite/innodb_fts/t/sync.test14
-rw-r--r--storage/innobase/fts/fts0opt.cc2
3 files changed, 26 insertions, 0 deletions
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)
{