diff options
author | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2022-03-09 18:17:10 +0530 |
---|---|---|
committer | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2022-03-11 14:39:25 +0530 |
commit | 16c9eb5687354e27fe8195ecb2a42afc902b39bf (patch) | |
tree | 538d218483fb884a3accf7535c3f50b65007bdb8 | |
parent | 9b8d9a1db32e7526e2b290bdb1f232eb444ae259 (diff) | |
download | mariadb-git-16c9eb5687354e27fe8195ecb2a42afc902b39bf.tar.gz |
MDEV-27672 Assertion `!table->fts->in_queue' failed in fts_optimize_remove_table
- During rollback of InnoDB DDL, it un-necessary removes the table
from fts_optimize_wq. Removal of fts table from fts_optimize_wq when
it has only one fulltext and it is being rollbacked.
-rw-r--r-- | storage/innobase/handler/handler0alter.cc | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index a68a17d3401..41fc37fcfe9 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -8715,13 +8715,14 @@ inline bool rollback_inplace_alter_table(Alter_inplace_info *ha_alter_info, const bool fts_exist= (ctx->new_table->flags2 & (DICT_TF2_FTS_HAS_DOC_ID | DICT_TF2_FTS)) || ctx->adding_fulltext_index(); - if (fts_exist) - { - fts_optimize_remove_table(ctx->new_table); - purge_sys.stop_FTS(*ctx->new_table); - } if (ctx->need_rebuild()) { + if (fts_exist) + { + fts_optimize_remove_table(ctx->new_table); + purge_sys.stop_FTS(*ctx->new_table); + } + dberr_t err= lock_table_for_trx(ctx->new_table, ctx->trx, LOCK_X); if (fts_exist) { @@ -8768,12 +8769,25 @@ inline bool rollback_inplace_alter_table(Alter_inplace_info *ha_alter_info, if (fts_exist) { + const dict_index_t *fts_index= nullptr; for (ulint a= 0; a < ctx->num_to_add_index; a++) { const dict_index_t *index = ctx->add_index[a]; if (index->type & DICT_FTS) - ut_a(!fts_lock_index_tables(ctx->trx, *index)); + fts_index= index; } + + /* Remove the fts table from fts_optimize_wq if there are + no FTS secondary index exist other than newly added one */ + if (fts_index && + (ib_vector_is_empty(prebuilt->table->fts->indexes) || + (ib_vector_size(prebuilt->table->fts->indexes) == 1 && + fts_index == static_cast<dict_index_t*>( + ib_vector_getp(prebuilt->table->fts->indexes, 0))))) + fts_optimize_remove_table(prebuilt->table); + + purge_sys.stop_FTS(*prebuilt->table); + ut_a(!fts_index || !fts_lock_index_tables(ctx->trx, *fts_index)); ut_a(!fts_lock_common_tables(ctx->trx, *ctx->new_table)); ut_a(!lock_sys_tables(ctx->trx)); } |