MDEV-30393 InnoDB: Assertion failure in dict0dict.cc upon ADD FULLTEXT INDEX

Problem:
========
- InnoDB fails to remove the newly created table or index from
data dictionary and table cache if the alter fails in commit phase

Solution:
========
- InnoDB should restart the transaction to remove the newly
created table and index when it fails in commit phase of an alter
operation. innodb_fts.misc_debug tests the scenario with the
help of debug point "stats_lock_fail"
parent 8c2dcfab
......@@ -11273,7 +11273,8 @@ ha_innobase::commit_inplace_alter_table(
}
DBUG_EXECUTE_IF("stats_lock_fail",
error = DB_LOCK_WAIT_TIMEOUT;);
error = DB_LOCK_WAIT_TIMEOUT;
trx_rollback_for_mysql(trx););
if (error == DB_SUCCESS) {
error = lock_sys_tables(trx);
......@@ -11291,6 +11292,18 @@ ha_innobase::commit_inplace_alter_table(
if (fts_exist) {
purge_sys.resume_FTS();
}
if (trx->state == TRX_STATE_NOT_STARTED) {
/* Transaction may have been rolled back
due to a lock wait timeout, deadlock,
or a KILL statement. So restart the
transaction to remove the newly created
table or index stubs from data dictionary
and table cache in
rollback_inplace_alter_table() */
trx_start_for_ddl(trx);
}
DBUG_RETURN(true);
}
......
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