MDEV-25200 Index count mismatch due to aborted FULLTEXT INDEX

- Aborting of fulltext index creation fails to remove the
index from sys indexes table. When we try to reload the
table definition, InnoDB fails with index count mismatch
error. InnoDB should remove the index from sys indexes while
rollbacking the secondary index creation.
parent 108ba4c3
...@@ -26,3 +26,29 @@ SET DEBUG_DBUG="+d,fts_instrument_sync"; ...@@ -26,3 +26,29 @@ SET DEBUG_DBUG="+d,fts_instrument_sync";
INSERT INTO t1 VALUES(1, "mariadb"); INSERT INTO t1 VALUES(1, "mariadb");
ALTER TABLE t1 FORCE; ALTER TABLE t1 FORCE;
DROP TABLE t2, t1; DROP TABLE t2, t1;
#
# MDEV-25200 Index count mismatch due to aborted FULLTEXT INDEX
#
CREATE TABLE t1(a INT, b TEXT, c TEXT, FULLTEXT INDEX(b)) ENGINE=InnoDB;
connect con1,localhost,root,,test;
SET DEBUG_SYNC='innodb_inplace_alter_table_enter SIGNAL s1 WAIT_FOR g1';
SET DEBUG_SYNC='innodb_commit_inplace_alter_table_enter SIGNAL s2 WAIT_FOR g2';
ALTER TABLE t1 ADD FULLTEXT(c);
connection default;
SET DEBUG_SYNC='now WAIT_FOR s1';
KILL QUERY @id;
SET DEBUG_SYNC='now SIGNAL g1 WAIT_FOR s2';
START TRANSACTION;
SELECT * FROM t1;
a b c
SET DEBUG_SYNC='now SIGNAL s2';
connection con1;
ERROR 70100: Query execution was interrupted
disconnect con1;
connection default;
SET DEBUG_SYNC=RESET;
ALTER TABLE t1 ADD bl INT AS (LENGTH(b)) VIRTUAL;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_debug.inc --source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/count_sessions.inc
# Following test is for Bug 14668777 - ASSERT ON IB_VECTOR_SIZE( # Following test is for Bug 14668777 - ASSERT ON IB_VECTOR_SIZE(
# TABLE->FTS->INDEXES, ALTER TABLE # TABLE->FTS->INDEXES, ALTER TABLE
...@@ -52,3 +54,32 @@ INSERT INTO t1 VALUES(1, "mariadb"); ...@@ -52,3 +54,32 @@ INSERT INTO t1 VALUES(1, "mariadb");
ALTER TABLE t1 FORCE; ALTER TABLE t1 FORCE;
# Cleanup # Cleanup
DROP TABLE t2, t1; DROP TABLE t2, t1;
--echo #
--echo # MDEV-25200 Index count mismatch due to aborted FULLTEXT INDEX
--echo #
CREATE TABLE t1(a INT, b TEXT, c TEXT, FULLTEXT INDEX(b)) ENGINE=InnoDB;
connect(con1,localhost,root,,test);
let $ID= `SELECT @id := CONNECTION_ID()`;
SET DEBUG_SYNC='innodb_inplace_alter_table_enter SIGNAL s1 WAIT_FOR g1';
SET DEBUG_SYNC='innodb_commit_inplace_alter_table_enter SIGNAL s2 WAIT_FOR g2';
send ALTER TABLE t1 ADD FULLTEXT(c);
connection default;
SET DEBUG_SYNC='now WAIT_FOR s1';
let $ignore= `SELECT @id := $ID`;
KILL QUERY @id;
SET DEBUG_SYNC='now SIGNAL g1 WAIT_FOR s2';
START TRANSACTION;
SELECT * FROM t1;
SET DEBUG_SYNC='now SIGNAL s2';
connection con1;
--error ER_QUERY_INTERRUPTED
reap;
disconnect con1;
connection default;
SET DEBUG_SYNC=RESET;
# Exploit MDEV-17468 to force the table definition to be reloaded
ALTER TABLE t1 ADD bl INT AS (LENGTH(b)) VIRTUAL;
CHECK TABLE t1;
DROP TABLE t1;
--source include/wait_until_count_sessions.inc
...@@ -3768,6 +3768,8 @@ row_merge_drop_indexes( ...@@ -3768,6 +3768,8 @@ row_merge_drop_indexes(
ut_ad(prev); ut_ad(prev);
ut_a(table->fts); ut_a(table->fts);
fts_drop_index(table, index, trx); fts_drop_index(table, index, trx);
row_merge_drop_index_dict(
trx, index->id);
/* We can remove a DICT_FTS /* We can remove a DICT_FTS
index from the cache, because index from the cache, because
we do not allow ADD FULLTEXT INDEX we do not allow ADD FULLTEXT INDEX
......
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