1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-03 05:41:09 +03:00

MDEV-27582 Fulltext DDL decrements the FTS_DOC_ID value

- InnoDB FTS DDL decrements the FTS_DOC_ID when there is a
deleted marked record involved. FTS_DOC_ID must never be
reused. The purpose of FTS_DOC_ID is to be a unique row
identifier that will be changed whenever a fulltext indexed
column is updated.
This commit is contained in:
Thirunarayanan Balathandayuthapani
2022-02-03 12:57:32 +05:30
parent 0635088deb
commit 1248fe7277
6 changed files with 90 additions and 53 deletions

View File

@@ -289,3 +289,32 @@ ENGINE=InnoDB;
ALTER TABLE t1 ADD c SERIAL;
DROP TABLE t1;
# End of 10.3 tests
#
# MDEV-27582 Fulltext DDL decrements the FTS_DOC_ID value
#
CREATE TABLE t1 (
f1 INT NOT NULL PRIMARY KEY,
f2 VARCHAR(64), FULLTEXT ft(f2)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
connect con1,localhost,root,,,;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
DELETE FROM t1 WHERE f1 = 2;
ALTER TABLE t1 DROP INDEX ft;
ALTER TABLE t1 ADD FULLTEXT INDEX ft (f2);
INSERT INTO t1 VALUES (3, 'innodb fts search');
SET GLOBAL innodb_optimize_fulltext_only=ON;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
SET GLOBAL innodb_ft_aux_table = 'test/t1';
SELECT max(DOC_ID) FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
max(DOC_ID)
3
SELECT * FROM t1 WHERE MATCH(f2) AGAINST("+innodb +search" IN BOOLEAN MODE);
f1 f2
3 innodb fts search
DROP TABLE t1;
disconnect con1;
SET GLOBAL innodb_optimize_fulltext_only=OFF;
SET GLOBAL innodb_ft_aux_table = default;

View File

@@ -1 +1,2 @@
--enable-plugin-innodb-sys-tables
--innodb_ft_index_table

View File

@@ -357,3 +357,28 @@ ALTER TABLE t1 ADD c SERIAL;
DROP TABLE t1;
--echo # End of 10.3 tests
--echo #
--echo # MDEV-27582 Fulltext DDL decrements the FTS_DOC_ID value
--echo #
CREATE TABLE t1 (
f1 INT NOT NULL PRIMARY KEY,
f2 VARCHAR(64), FULLTEXT ft(f2)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
connect(con1,localhost,root,,,);
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
DELETE FROM t1 WHERE f1 = 2;
ALTER TABLE t1 DROP INDEX ft;
ALTER TABLE t1 ADD FULLTEXT INDEX ft (f2);
INSERT INTO t1 VALUES (3, 'innodb fts search');
SET GLOBAL innodb_optimize_fulltext_only=ON;
OPTIMIZE TABLE t1;
SET GLOBAL innodb_ft_aux_table = 'test/t1';
SELECT max(DOC_ID) FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
SELECT * FROM t1 WHERE MATCH(f2) AGAINST("+innodb +search" IN BOOLEAN MODE);
DROP TABLE t1;
disconnect con1;
SET GLOBAL innodb_optimize_fulltext_only=OFF;
SET GLOBAL innodb_ft_aux_table = default;