mariadb/mysql-test/suite/galera/t/galera_fulltext.test
sjaakola d5a15f04f4 MDEV-24978 crash with transaction on table with no PK and long fulltext column
If a table has no unique indexes, write set key information will be collected on all columns in the table.
The write set key information has space only for max 3500 bytes for individual column, and if a varchar colummn of such non-primary key table is longer than
 this limit, currently a crash follows.
The fix in this commit, is to truncate key values extracted from such long varhar columns to max 3500 bytes.
This may potentially lead to false positive certification failures for transactions, which operate on separate cluster nodes, and update/insert/delete table rows, which differ only in the part of such long columns after 3500 bytes border.

Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
2021-09-30 11:19:34 +03:00

107 lines
2.4 KiB
Text

--source include/galera_cluster.inc
#
# InnoDB FULLTEXT indexes
#
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
#
# Fulltext index creation causes the creation of multiple system tables
#
--connection node_1
CREATE TABLE t1 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(100), FULLTEXT (f2)) ENGINE=InnoDB;
--connection node_2
SELECT COUNT(*) = 13 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name LIKE 'test/%';
#
# Fulltext insertion causes a flurry of updates on those system tables
#
--connection node_1
# Insert 1K rows
INSERT INTO t1 (f2) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3;
--connection node_2
SELECT COUNT(f2) = 1000 FROM t1 WHERE MATCH(f2) AGAINST ('foobarbaz');
UPDATE t1 SET f2 = 'abcdefjhk';
--connection node_1
SELECT COUNT(f2) = 1000 FROM t1 WHERE MATCH(f2) AGAINST ('abcdefjhk');
--connection node_2
DROP TABLE t1;
#
# Same on a table with no PK
#
--connection node_1
CREATE TABLE t1 (f1 VARCHAR(100), FULLTEXT (f1)) ENGINE=InnoDB;
--connection node_2
# We insert only 1K rows here, because updates without a PK are very slow
INSERT INTO t1 (f1) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3;
--connection node_1
SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('foobarbaz');
UPDATE t1 SET f1 = 'abcdefjhk';
--connection node_2
SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('abcdefjhk');
DROP TABLE t1;
DROP TABLE ten;
#
# MDEV-24978 : SIGABRT in __libc_message
#
--connection node_1
SET @value=REPEAT (1,5001);
CREATE TABLE t (a VARCHAR(5000),FULLTEXT (a)) engine=innodb;
INSERT IGNORE INTO t VALUES(@value);
SELECT COUNT(*) FROM t;
--connection node_2
SELECT COUNT(*) FROM t;
--connection node_1
DROP TABLE t;
CREATE TABLE t (a VARCHAR(5000)) engine=innodb;
INSERT IGNORE INTO t VALUES(@value);
SELECT COUNT(*) FROM t;
--connection node_2
SELECT COUNT(*) FROM t;
--connection node_1
DROP TABLE t;
#
# Case 2: UTF-8
#
--connection node_1
SET @value=REPEAT (1,5001);
CREATE TABLE t (a VARCHAR(5000),FULLTEXT (a)) engine=innodb DEFAULT CHARSET=utf8;
INSERT IGNORE INTO t VALUES(@value);
SELECT COUNT(*) FROM t;
--connection node_2
SELECT COUNT(*) FROM t;
--connection node_1
DROP TABLE t;
CREATE TABLE t (a VARCHAR(5000)) engine=innodb DEFAULT CHARSET=utf8;
INSERT IGNORE INTO t VALUES(@value);
SELECT COUNT(*) FROM t;
--connection node_2
SELECT COUNT(*) FROM t;
--connection node_1
DROP TABLE t;