MDEV-28079 Shutdown hangs after altering innodb partition fts table

- InnoDB purge waits at resume_FTS() while shutting down.
This happens after altering the FTS innodb partition table.
stop_FTS() has been called for each partition, but it calls
resume_FTS() only once and it leads to hang during shutdown.
This issue was introduced by
commit 1bd681c8(MDEV-25506).
parent b2c81e06
......@@ -48,3 +48,11 @@ alter table t1 add partition (partition p0 values less than (20));
ERROR HY000: Duplicate partition name p0
alter table t1 add partition (partition p1 values less than (20)) /* comment */;
drop table t1;
#
# MDEV-28079 Shutdown hangs after altering innodb partition fts table
#
CREATE TABLE t1(f1 INT, f2 CHAR(100))ENGINE=InnoDB PARTITION BY HASH(f1) PARTITIONS 2;
ALTER TABLE t1 ADD FULLTEXT(f2);
InnoDB 0 transactions not purged
DROP TABLE t1;
# End of 10.6 tests
......@@ -9,3 +9,11 @@ SET GLOBAL innodb_read_only_compressed=OFF;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
--enable_query_log
--echo #
--echo # MDEV-28079 Shutdown hangs after altering innodb partition fts table
--echo #
CREATE TABLE t1(f1 INT, f2 CHAR(100))ENGINE=InnoDB PARTITION BY HASH(f1) PARTITIONS 2;
ALTER TABLE t1 ADD FULLTEXT(f2);
--source ../innodb/include/wait_all_purged.inc
DROP TABLE t1;
--echo # End of 10.6 tests
......@@ -1567,10 +1567,13 @@ static void fts_table_no_ref_count(const char *table_name)
/** Stop the purge thread and check n_ref_count of all auxiliary
and common table associated with the fts table.
@param table parent FTS table */
void purge_sys_t::stop_FTS(const dict_table_t &table)
@param table parent FTS table
@param already_stopped True indicates purge threads were
already stopped*/
void purge_sys_t::stop_FTS(const dict_table_t &table, bool already_stopped)
{
purge_sys.stop_FTS();
if (!already_stopped)
purge_sys.stop_FTS();
fts_table_t fts_table;
char table_name[MAX_FULL_NAME_LEN];
......
......@@ -10903,12 +10903,14 @@ ha_innobase::commit_inplace_alter_table(
}
}
bool already_stopped= false;
for (inplace_alter_handler_ctx** pctx = ctx_array; *pctx; pctx++) {
auto ctx = static_cast<ha_innobase_inplace_ctx*>(*pctx);
dberr_t error = DB_SUCCESS;
if (fts_exist) {
purge_sys.stop_FTS(*ctx->old_table);
purge_sys.stop_FTS(*ctx->old_table, already_stopped);
already_stopped = true;
}
if (new_clustered && ctx->old_table->fts) {
......
......@@ -286,8 +286,10 @@ class purge_sys_t
/** Stop the purge thread and check n_ref_count of all auxiliary
and common table associated with the fts table.
@param table parent FTS table */
void stop_FTS(const dict_table_t &table);
@param table parent FTS table
@param already_stopped True indicates purge threads were
already stopped */
void stop_FTS(const dict_table_t &table, bool already_stopped=false);
};
/** The global data structure coordinating a purge */
......
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