MDEV-25295 Aborted FTS_DOC_ID_INDEX considered as existing FTS_DOC_ID_INDEX during DDL

InnoDB should skip the dropped aborted FTS_DOC_ID_INDEX while
checking the existing FTS_DOC_ID_INDEX in the table. InnoDB
should able to create new FTS_DOC_ID_INDEX if the fulltext
index is being added for the first time.
parent 6fe624b5
...@@ -691,3 +691,16 @@ FTS_DOC_ID t ...@@ -691,3 +691,16 @@ FTS_DOC_ID t
2 foo bar 2 foo bar
3 foo 3 foo
DROP TABLE t; DROP TABLE t;
#
# MDEV-25295 Aborted FTS_DOC_ID_INDEX considered as
# existing FTS_DOC_ID_INDEX during DDL
#
SET sql_mode='';
CREATE TABLE t1 (FTS_DOC_ID BIGINT UNSIGNED NOT NULL,title CHAR(1),body TEXT)engine=innodb;
INSERT INTO t1 (FTS_DOC_ID,title,body)VALUES(1,0,0), (1,0,0);
CREATE FULLTEXT INDEX idx1 ON t1 (title,body);
ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
CREATE FULLTEXT INDEX idx1 ON t1 (title,body);
ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
DROP TABLE t1;
SET sql_mode = DEFAULT;
...@@ -717,3 +717,17 @@ while ($N) ...@@ -717,3 +717,17 @@ while ($N)
} }
DROP TABLE t; DROP TABLE t;
--echo #
--echo # MDEV-25295 Aborted FTS_DOC_ID_INDEX considered as
--echo # existing FTS_DOC_ID_INDEX during DDL
--echo #
SET sql_mode='';
CREATE TABLE t1 (FTS_DOC_ID BIGINT UNSIGNED NOT NULL,title CHAR(1),body TEXT)engine=innodb;
INSERT INTO t1 (FTS_DOC_ID,title,body)VALUES(1,0,0), (1,0,0);
--error ER_DUP_ENTRY
CREATE FULLTEXT INDEX idx1 ON t1 (title,body);
--error ER_DUP_ENTRY
CREATE FULLTEXT INDEX idx1 ON t1 (title,body);
DROP TABLE t1;
SET sql_mode = DEFAULT;
...@@ -2404,9 +2404,11 @@ innobase_fts_check_doc_id_index( ...@@ -2404,9 +2404,11 @@ innobase_fts_check_doc_id_index(
for (index = dict_table_get_first_index(table); for (index = dict_table_get_first_index(table);
index; index = dict_table_get_next_index(index)) { index; index = dict_table_get_next_index(index)) {
/* Check if there exists a unique index with the name of /* Check if there exists a unique index with the name of
FTS_DOC_ID_INDEX_NAME */ FTS_DOC_ID_INDEX_NAME and ignore the corrupted index */
if (innobase_strcasecmp(index->name, FTS_DOC_ID_INDEX_NAME)) { if (index->type & DICT_CORRUPT
|| innobase_strcasecmp(index->name, FTS_DOC_ID_INDEX_NAME)) {
continue; continue;
} }
......
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