diff options
author | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2023-01-23 18:06:13 +0530 |
---|---|---|
committer | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2023-01-24 13:13:52 +0530 |
commit | ef6b3806bb2cc2e44f2dbebb80f4496df10185a7 (patch) | |
tree | 2a56d68c54f2a6bc2f5411e2c435a36c401d7ddc | |
parent | 8c2dcfab031f14d7d6269f160217d2068236833b (diff) | |
download | mariadb-git-ef6b3806bb2cc2e44f2dbebb80f4496df10185a7.tar.gz |
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"
-rw-r--r-- | storage/innobase/handler/handler0alter.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 7c162b9af6a..c6400544f73 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -11273,7 +11273,8 @@ err_index: } 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 @@ err_index: 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); } |