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.
parent 3d16e0e1
...@@ -145,3 +145,13 @@ id title ...@@ -145,3 +145,13 @@ id title
2 database 2 database
3 good 3 good
DROP TABLE t1; 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
...@@ -170,3 +170,17 @@ SET GLOBAL innodb_ft_aux_table=default; ...@@ -170,3 +170,17 @@ SET GLOBAL innodb_ft_aux_table=default;
SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database good'); SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database good');
DROP TABLE t1; 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
...@@ -3037,6 +3037,8 @@ fts_optimize_shutdown() ...@@ -3037,6 +3037,8 @@ fts_optimize_shutdown()
@param[in] table table to be synced */ @param[in] table table to be synced */
void fts_sync_during_ddl(dict_table_t* table) void fts_sync_during_ddl(dict_table_t* table)
{ {
if (!fts_optimize_wq)
return;
mutex_enter(&fts_optimize_wq->mutex); mutex_enter(&fts_optimize_wq->mutex);
if (!table->fts->sync_message) if (!table->fts->sync_message)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment