Commit e1414fc7 authored by Thirunarayanan Balathandayuthapani's avatar Thirunarayanan Balathandayuthapani Committed by Marko Mäkelä

MDEV-29778 Having Unique index interference with MATCH from a FULLTEXT

InnoDB fails to fetch FTS_DOC_ID if the select query uses secondary
index. So always do extra lookup on clustered index in case of fts
query
parent e11661a4
......@@ -774,4 +774,15 @@ UNLOCK TABLES;
ALTER TABLE t1 DISCARD TABLESPACE;
ALTER TABLE t2 IMPORT TABLESPACE;
DROP TABLE t2, t1;
#
# MDEV-29778 Having Unique index interference with MATCH
# from a FULLTEXT
#
CREATE TABLE t1(f1 VARCHAR(100), FULLTEXT(f1),
UNIQUE INDEX(f1))ENGINE=InnoDB;
INSERT INTO t1 VALUES("test");
SELECT f1, MATCH(f1) AGAINST ("test" IN BOOLEAN MODE) FROM t1;
f1 MATCH(f1) AGAINST ("test" IN BOOLEAN MODE)
test 0.000000001885928302414186
DROP TABLE t1;
# End of 10.3 tests
......@@ -790,4 +790,14 @@ ALTER TABLE t2 IMPORT TABLESPACE;
--enable_warnings
DROP TABLE t2, t1;
--echo #
--echo # MDEV-29778 Having Unique index interference with MATCH
--echo # from a FULLTEXT
--echo #
CREATE TABLE t1(f1 VARCHAR(100), FULLTEXT(f1),
UNIQUE INDEX(f1))ENGINE=InnoDB;
INSERT INTO t1 VALUES("test");
SELECT f1, MATCH(f1) AGAINST ("test" IN BOOLEAN MODE) FROM t1;
DROP TABLE t1;
--echo # End of 10.3 tests
......@@ -7703,6 +7703,11 @@ ha_innobase::build_template(
m_prebuilt->versioned_write = table->versioned_write(VERS_TRX_ID);
m_prebuilt->need_to_access_clustered = (index == clust_index);
if (m_prebuilt->in_fts_query) {
/* Do clustered index lookup to fetch the FTS_DOC_ID */
m_prebuilt->need_to_access_clustered = true;
}
/* Either m_prebuilt->index should be a secondary index, or it
should be the clustered index. */
ut_ad(dict_index_is_clust(index) == (index == clust_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