Skip to content

Commit ca88eac

Browse files
dr-msanja-byelkin
authored andcommitted
MDEV-30528 CREATE FULLTEXT INDEX assertion failure WITH SYSTEM VERSIONING
ha_innobase::check_if_supported_inplace_alter(): Require ALGORITHM=COPY when creating a FULLTEXT INDEX on a versioned table. row_merge_buf_add(), row_merge_read_clustered_index(): Remove the parameter or local variable history_fts that had been added in the attempt to fix MDEV-25004. Reviewed by: Thirunarayanan Balathandayuthapani Tested by: Matthias Leich
1 parent c37216d commit ca88eac

17 files changed

+366
-24
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
--- innodb-fts-ddl.result
2+
+++ innodb-fts-ddl.reject
3+
@@ -11,8 +11,10 @@
4+
('MySQL vs. YourSQL','In the following database comparison ...'),
5+
('MySQL Security','When configured properly, MySQL ...');
6+
ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY;
7+
-ERROR 0A000: ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=INPLACE
8+
-ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=INPLACE;
9+
+ERROR 0A000: ALGORITHM=NOCOPY is not supported. Reason: Not implemented for system-versioned operations. Try ALGORITHM=COPY
10+
+ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body);
11+
+affected rows: 6
12+
+info: Records: 6 Duplicates: 0 Warnings: 0
13+
SELECT * FROM fts_test WHERE MATCH (title, body)
14+
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
15+
id title body
16+
@@ -26,7 +28,9 @@
17+
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
18+
('MySQL vs. YourSQL','In the following database comparison ...'),
19+
('MySQL Security','When configured properly, MySQL ...');
20+
-ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY;
21+
+ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body);
22+
+affected rows: 12
23+
+info: Records: 12 Duplicates: 0 Warnings: 0
24+
SELECT * FROM fts_test WHERE MATCH (title, body)
25+
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
26+
id title body
27+
@@ -76,8 +80,10 @@
28+
('MySQL vs. YourSQL','In the following database comparison ...'),
29+
('MySQL Security','When configured properly, MySQL ...');
30+
CREATE FULLTEXT INDEX idx on fts_test (title, body) LOCK=NONE;
31+
-ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED
32+
-ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY;
33+
+ERROR 0A000: LOCK=NONE is not supported. Reason: Not implemented for system-versioned operations. Try LOCK=SHARED
34+
+ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body);
35+
+affected rows: 6
36+
+info: Records: 6 Duplicates: 0 Warnings: 0
37+
ALTER TABLE fts_test ROW_FORMAT=REDUNDANT, LOCK=NONE;
38+
ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED
39+
ALTER TABLE fts_test ROW_FORMAT=REDUNDANT;
40+
@@ -162,7 +168,7 @@
41+
(20, 'MySQL Security','When configured properly, MySQL ...');
42+
ALTER TABLE articles ADD FULLTEXT INDEX idx (title),
43+
ADD FULLTEXT INDEX idx3 (title), ALGORITHM=INPLACE;
44+
-ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY
45+
+ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Not implemented for system-versioned operations. Try ALGORITHM=COPY
46+
ALTER TABLE articles ADD FULLTEXT INDEX idx (title),
47+
ADD FULLTEXT INDEX idx3 (title);
48+
affected rows: 6
49+
@@ -274,7 +280,7 @@
50+
call mtr.add_suppression("InnoDB: Failed to create");
51+
CREATE TABLE t1(a TEXT, FTS_DOC_ID BIGINT UNSIGNED NOT NULL UNIQUE) ENGINE=InnoDB;
52+
ALTER TABLE t1 ADD FULLTEXT(a), ALGORITHM=INPLACE;
53+
-ERROR HY000: Got error 11 "Resource temporarily unavailable" from storage engine InnoDB
54+
+ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Not implemented for system-versioned operations. Try ALGORITHM=COPY
55+
DROP TABLE t1;
56+
CREATE TABLE t1 (a VARCHAR(3)) ENGINE=InnoDB;
57+
ALTER TABLE t1 ADD FULLTEXT KEY(a), ADD COLUMN b VARCHAR(3), ADD FULLTEXT KEY(b);
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
--- innodb-fts-ddl.result
2+
+++ innodb-fts-ddl.reject
3+
@@ -11,8 +11,10 @@
4+
('MySQL vs. YourSQL','In the following database comparison ...'),
5+
('MySQL Security','When configured properly, MySQL ...');
6+
ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY;
7+
-ERROR 0A000: ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=INPLACE
8+
-ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=INPLACE;
9+
+ERROR 0A000: ALGORITHM=NOCOPY is not supported. Reason: Not implemented for system-versioned operations. Try ALGORITHM=COPY
10+
+ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body);
11+
+affected rows: 6
12+
+info: Records: 6 Duplicates: 0 Warnings: 0
13+
SELECT * FROM fts_test WHERE MATCH (title, body)
14+
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
15+
id title body
16+
@@ -26,7 +28,9 @@
17+
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
18+
('MySQL vs. YourSQL','In the following database comparison ...'),
19+
('MySQL Security','When configured properly, MySQL ...');
20+
-ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY;
21+
+ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body);
22+
+affected rows: 12
23+
+info: Records: 12 Duplicates: 0 Warnings: 0
24+
SELECT * FROM fts_test WHERE MATCH (title, body)
25+
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
26+
id title body
27+
@@ -76,8 +80,10 @@
28+
('MySQL vs. YourSQL','In the following database comparison ...'),
29+
('MySQL Security','When configured properly, MySQL ...');
30+
CREATE FULLTEXT INDEX idx on fts_test (title, body) LOCK=NONE;
31+
-ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED
32+
-ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY;
33+
+ERROR 0A000: LOCK=NONE is not supported. Reason: Not implemented for system-versioned operations. Try LOCK=SHARED
34+
+ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body);
35+
+affected rows: 6
36+
+info: Records: 6 Duplicates: 0 Warnings: 0
37+
ALTER TABLE fts_test ROW_FORMAT=REDUNDANT, LOCK=NONE;
38+
ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED
39+
ALTER TABLE fts_test ROW_FORMAT=REDUNDANT;
40+
@@ -162,7 +168,7 @@
41+
(20, 'MySQL Security','When configured properly, MySQL ...');
42+
ALTER TABLE articles ADD FULLTEXT INDEX idx (title),
43+
ADD FULLTEXT INDEX idx3 (title), ALGORITHM=INPLACE;
44+
-ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY
45+
+ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Not implemented for system-versioned operations. Try ALGORITHM=COPY
46+
ALTER TABLE articles ADD FULLTEXT INDEX idx (title),
47+
ADD FULLTEXT INDEX idx3 (title);
48+
affected rows: 6
49+
@@ -274,7 +280,7 @@
50+
call mtr.add_suppression("InnoDB: Failed to create");
51+
CREATE TABLE t1(a TEXT, FTS_DOC_ID BIGINT UNSIGNED NOT NULL UNIQUE) ENGINE=InnoDB;
52+
ALTER TABLE t1 ADD FULLTEXT(a), ALGORITHM=INPLACE;
53+
-ERROR HY000: Got error 11 "Resource temporarily unavailable" from storage engine InnoDB
54+
+ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Not implemented for system-versioned operations. Try ALGORITHM=COPY
55+
DROP TABLE t1;
56+
CREATE TABLE t1 (a VARCHAR(3)) ENGINE=InnoDB;
57+
ALTER TABLE t1 ADD FULLTEXT KEY(a), ADD COLUMN b VARCHAR(3), ADD FULLTEXT KEY(b);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--- innodb-fts-fic.result
2+
+++ innodb-fts-fic.reject
3+
@@ -172,7 +172,6 @@
4+
(1, 'MySQL Tutorial','DBMS stands for DataBase ...'),
5+
(2, 'How To Use MySQL Well','After you went through a ...');
6+
CREATE FULLTEXT INDEX idx ON wp(title, text);
7+
-ERROR HY000: Column 'FTS_DOC_ID' is of wrong type for an InnoDB FULLTEXT index
8+
DROP TABLE wp;
9+
CREATE TABLE wp(
10+
FTS_DOC_ID bigint unsigned PRIMARY KEY,
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--- innodb-fts-fic.result
2+
+++ innodb-fts-fic.reject
3+
@@ -172,7 +172,6 @@
4+
(1, 'MySQL Tutorial','DBMS stands for DataBase ...'),
5+
(2, 'How To Use MySQL Well','After you went through a ...');
6+
CREATE FULLTEXT INDEX idx ON wp(title, text);
7+
-ERROR HY000: Column 'FTS_DOC_ID' is of wrong type for an InnoDB FULLTEXT index
8+
DROP TABLE wp;
9+
CREATE TABLE wp(
10+
FTS_DOC_ID bigint unsigned PRIMARY KEY,
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
--- misc_debug.result
2+
+++ misc_debug.reject
3+
@@ -7,14 +7,14 @@
4+
SET @saved_debug_dbug = @@SESSION.debug_dbug;
5+
SET SESSION debug_dbug="+d,ib_dict_create_index_tree_fail";
6+
CREATE FULLTEXT INDEX idx ON articles(body);
7+
-ERROR HY000: Out of memory.
8+
+ERROR HY000: Can't create table `test`.`articles` (errno: 128 "Out of memory in engine")
9+
SET SESSION debug_dbug=@saved_debug_dbug;
10+
ALTER TABLE articles STATS_PERSISTENT=DEFAULT;
11+
DROP TABLE articles;
12+
CREATE TABLE t (a INT, b TEXT) engine=innodb;
13+
SET debug_dbug='+d,alter_table_rollback_new_index';
14+
-ALTER TABLE t ADD FULLTEXT INDEX (b(64));
15+
-ERROR HY000: Unknown error
16+
+ALTER TABLE t ADD FULLTEXT INDEX (b(64)), ALGORITHM=INPLACE;
17+
+ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Not implemented for system-versioned operations. Try ALGORITHM=COPY
18+
SET SESSION debug_dbug=@saved_debug_dbug;
19+
DROP TABLE t;
20+
CREATE TABLE t1 (pk INT, a VARCHAR(8), PRIMARY KEY(pk),
21+
@@ -27,32 +27,6 @@
22+
ALTER TABLE t1 FORCE;
23+
DROP TABLE t2, t1;
24+
#
25+
-# MDEV-25200 Index count mismatch due to aborted FULLTEXT INDEX
26+
-#
27+
-CREATE TABLE t1(a INT, b TEXT, c TEXT, FULLTEXT INDEX(b)) ENGINE=InnoDB;
28+
-INSERT INTO t1 VALUES(1, "test", "test_1");
29+
-connect con1,localhost,root,,test;
30+
-SET DEBUG_DBUG="+d,innodb_OOM_inplace_alter";
31+
-SET DEBUG_SYNC='innodb_commit_inplace_alter_table_enter SIGNAL s2 WAIT_FOR g2';
32+
-ALTER TABLE t1 ADD FULLTEXT(c);
33+
-connection default;
34+
-SET DEBUG_SYNC='now WAIT_FOR s2';
35+
-START TRANSACTION;
36+
-SELECT * FROM t1;
37+
-a b c
38+
-1 test test_1
39+
-SET DEBUG_SYNC='now SIGNAL g2';
40+
-connection con1;
41+
-ERROR HY000: Out of memory.
42+
-disconnect con1;
43+
-connection default;
44+
-SET DEBUG_SYNC=RESET;
45+
-ALTER TABLE t1 ADD bl INT AS (LENGTH(b)) VIRTUAL;
46+
-CHECK TABLE t1;
47+
-Table Op Msg_type Msg_text
48+
-test.t1 check status OK
49+
-DROP TABLE t1;
50+
-#
51+
# MDEV-25663 Double free of transaction during TRUNCATE
52+
#
53+
call mtr.add_suppression("InnoDB: \\(Too many concurrent transactions\\)");
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
--- misc_debug.result
2+
+++ misc_debug.reject
3+
@@ -7,14 +7,14 @@
4+
SET @saved_debug_dbug = @@SESSION.debug_dbug;
5+
SET SESSION debug_dbug="+d,ib_dict_create_index_tree_fail";
6+
CREATE FULLTEXT INDEX idx ON articles(body);
7+
-ERROR HY000: Out of memory.
8+
+ERROR HY000: Can't create table `test`.`articles` (errno: 128 "Out of memory in engine")
9+
SET SESSION debug_dbug=@saved_debug_dbug;
10+
ALTER TABLE articles STATS_PERSISTENT=DEFAULT;
11+
DROP TABLE articles;
12+
CREATE TABLE t (a INT, b TEXT) engine=innodb;
13+
SET debug_dbug='+d,alter_table_rollback_new_index';
14+
-ALTER TABLE t ADD FULLTEXT INDEX (b(64));
15+
-ERROR HY000: Unknown error
16+
+ALTER TABLE t ADD FULLTEXT INDEX (b(64)), ALGORITHM=INPLACE;
17+
+ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Not implemented for system-versioned operations. Try ALGORITHM=COPY
18+
SET SESSION debug_dbug=@saved_debug_dbug;
19+
DROP TABLE t;
20+
CREATE TABLE t1 (pk INT, a VARCHAR(8), PRIMARY KEY(pk),
21+
@@ -27,32 +27,6 @@
22+
ALTER TABLE t1 FORCE;
23+
DROP TABLE t2, t1;
24+
#
25+
-# MDEV-25200 Index count mismatch due to aborted FULLTEXT INDEX
26+
-#
27+
-CREATE TABLE t1(a INT, b TEXT, c TEXT, FULLTEXT INDEX(b)) ENGINE=InnoDB;
28+
-INSERT INTO t1 VALUES(1, "test", "test_1");
29+
-connect con1,localhost,root,,test;
30+
-SET DEBUG_DBUG="+d,innodb_OOM_inplace_alter";
31+
-SET DEBUG_SYNC='innodb_commit_inplace_alter_table_enter SIGNAL s2 WAIT_FOR g2';
32+
-ALTER TABLE t1 ADD FULLTEXT(c);
33+
-connection default;
34+
-SET DEBUG_SYNC='now WAIT_FOR s2';
35+
-START TRANSACTION;
36+
-SELECT * FROM t1;
37+
-a b c
38+
-1 test test_1
39+
-SET DEBUG_SYNC='now SIGNAL g2';
40+
-connection con1;
41+
-ERROR HY000: Out of memory.
42+
-disconnect con1;
43+
-connection default;
44+
-SET DEBUG_SYNC=RESET;
45+
-ALTER TABLE t1 ADD bl INT AS (LENGTH(b)) VIRTUAL;
46+
-CHECK TABLE t1;
47+
-Table Op Msg_type Msg_text
48+
-test.t1 check status OK
49+
-DROP TABLE t1;
50+
-#
51+
# MDEV-25663 Double free of transaction during TRUNCATE
52+
#
53+
call mtr.add_suppression("InnoDB: \\(Too many concurrent transactions\\)");
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--- sync_ddl.result
2+
+++ sync_ddl.reject
3+
@@ -100,7 +100,7 @@
4+
ADD COLUMN id2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
5+
DROP INDEX idx1,
6+
ADD FULLTEXT INDEX idx2(value);
7+
-affected rows: 0
8+
-info: Records: 0 Duplicates: 0 Warnings: 0
9+
+affected rows: 2
10+
+info: Records: 2 Duplicates: 0 Warnings: 0
11+
DROP TABLE t1;
12+
SET GLOBAL debug_dbug = @save_debug;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--- sync_ddl.result
2+
+++ sync_ddl.reject
3+
@@ -100,7 +100,7 @@
4+
ADD COLUMN id2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
5+
DROP INDEX idx1,
6+
ADD FULLTEXT INDEX idx2(value);
7+
-affected rows: 0
8+
-info: Records: 0 Duplicates: 0 Warnings: 0
9+
+affected rows: 2
10+
+info: Records: 2 Duplicates: 0 Warnings: 0
11+
DROP TABLE t1;
12+
SET GLOBAL debug_dbug = @save_debug;

mysql-test/suite/innodb_fts/r/sync_ddl.result

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ ALTER TABLE t1
9999
DROP COLUMN id1,
100100
ADD COLUMN id2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
101101
DROP INDEX idx1,
102-
ADD FULLTEXT INDEX idx2(value),
103-
ALGORITHM=INPLACE;
102+
ADD FULLTEXT INDEX idx2(value);
103+
affected rows: 0
104+
info: Records: 0 Duplicates: 0 Warnings: 0
104105
DROP TABLE t1;
105106
SET GLOBAL debug_dbug = @save_debug;

mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,20 @@ INSERT INTO fts_test (title,body) VALUES
2020
('MySQL Security','When configured properly, MySQL ...');
2121

2222
# Table does rebuild when fts index builds for the first time
23+
# Create the FTS index
24+
25+
if ($MTR_COMBINATION_ORIG) {
2326
--error ER_ALTER_OPERATION_NOT_SUPPORTED
2427
ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY;
25-
26-
# Create the FTS index
2728
ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=INPLACE;
29+
}
30+
if (!$MTR_COMBINATION_ORIG) {
31+
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
32+
ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY;
33+
--enable_info
34+
ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body);
35+
--disable_info
36+
}
2837

2938
# Select word "tutorial" in the table
3039
SELECT * FROM fts_test WHERE MATCH (title, body)
@@ -43,7 +52,14 @@ INSERT INTO fts_test (title,body) VALUES
4352
('MySQL Security','When configured properly, MySQL ...');
4453

4554
# FTS_DOC_ID hidden column and FTS_DOC_ID index exist
55+
if ($MTR_COMBINATION_ORIG) {
4656
ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY;
57+
}
58+
if (!$MTR_COMBINATION_ORIG) {
59+
--enable_info
60+
ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body);
61+
--disable_info
62+
}
4763

4864
# Select word "tutorial" in the table
4965
SELECT * FROM fts_test WHERE MATCH (title, body)
@@ -112,7 +128,14 @@ INSERT INTO fts_test (title,body) VALUES
112128
# column already exists. This has not been implemented yet.
113129
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
114130
CREATE FULLTEXT INDEX idx on fts_test (title, body) LOCK=NONE;
131+
if ($MTR_COMBINATION_ORIG) {
115132
ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY;
133+
}
134+
if (!$MTR_COMBINATION_ORIG) {
135+
--enable_info
136+
ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body);
137+
--disable_info
138+
}
116139

117140
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
118141
ALTER TABLE fts_test ROW_FORMAT=REDUNDANT, LOCK=NONE;
@@ -349,8 +372,14 @@ let $fts_aux_file= `select concat('FTS_',right(concat(repeat('0',16), lower(hex(
349372
write_file $MYSQLD_DATADIR/test/$fts_aux_file;
350373
EOF
351374
--replace_regex /".*" from/"Resource temporarily unavailable" from/
375+
if ($MTR_COMBINATION_ORIG) {
352376
--error ER_GET_ERRNO
353377
ALTER TABLE t1 ADD FULLTEXT(a), ALGORITHM=INPLACE;
378+
}
379+
if (!$MTR_COMBINATION_ORIG) {
380+
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
381+
ALTER TABLE t1 ADD FULLTEXT(a), ALGORITHM=INPLACE;
382+
}
354383
DROP TABLE t1;
355384
remove_file $MYSQLD_DATADIR/test/$fts_aux_file;
356385

0 commit comments

Comments
 (0)