Skip to content

Commit

Permalink
Fix innodb_fts suite
Browse files Browse the repository at this point in the history
* update (some) tests from 5.7
* update results (e.g. cardinality is no longer reported)
* uncomment MYSQL_PLUGIN_FULLTEXT_PARSER/MYSQL_FTS_PARSER code
* initialize m_prebuilt->m_fts_limit manually,
   as we do not use ft_init_ext_with_hints()
  • Loading branch information
vuvova committed Sep 14, 2016
1 parent 4133d29 commit ea3262d
Show file tree
Hide file tree
Showing 13 changed files with 505 additions and 186 deletions.
6 changes: 3 additions & 3 deletions mysql-test/suite/innodb_fts/r/fulltext.result
Expand Up @@ -8,8 +8,8 @@ INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
ANALYZE TABLE t1;
SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a NULL 5 NULL NULL YES FULLTEXT
t1 1 a 2 b NULL 5 NULL NULL YES FULLTEXT
t1 1 a 1 a NULL NULL NULL NULL YES FULLTEXT
t1 1 a 2 b NULL NULL NULL NULL YES FULLTEXT
select * from t1 where MATCH(a,b) AGAINST ("collections");
a b
Full-text indexes are called collections
Expand Down Expand Up @@ -235,7 +235,7 @@ id
show keys from t2;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t2 1 tig 1 ticket A 3 NULL NULL YES BTREE
t2 1 tix 1 inhalt NULL 3 NULL NULL YES FULLTEXT
t2 1 tix 1 inhalt NULL NULL NULL NULL YES FULLTEXT
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
Expand Down
2 changes: 2 additions & 0 deletions mysql-test/suite/innodb_fts/r/innodb-fts-fic.result
@@ -1,3 +1,5 @@
call mtr.add_suppression("\\[Warning\\] InnoDB: A new Doc ID must be supplied while updating FTS indexed columns.");
call mtr.add_suppression("\\[Warning\\] InnoDB: FTS Doc ID must be larger than [0-9]+ for table `test`.`articles`");
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
Expand Down
166 changes: 86 additions & 80 deletions mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result

Large diffs are not rendered by default.

185 changes: 177 additions & 8 deletions mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result
@@ -1,29 +1,198 @@
INSTALL PLUGIN simple_parser SONAME 'mypluglib';
# Test Part 1: Grammar Test
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title) WITH PARSER simple_parser
) ENGINE=MyISAM;
ALTER TABLE articles ENGINE=InnoDB;
ERROR HY000: Cannot CREATE FULLTEXT INDEX WITH PARSER on InnoDB table
DROP TABLE articles;
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
comment TEXT,
FULLTEXT (title) WITH PARSER simple_parser
) ENGINE=InnoDB;
ERROR HY000: Cannot CREATE FULLTEXT INDEX WITH PARSER on InnoDB table
ALTER TABLE articles ADD FULLTEXT INDEX (body) WITH PARSER simple_parser;
CREATE FULLTEXT INDEX ft_index ON articles(comment) WITH PARSER simple_parser;
DROP TABLE articles;
# Test Part 2: Create Index Test(CREATE TABLE WITH FULLTEXT INDEX)
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title)
FULLTEXT (title, body) WITH PARSER simple_parser
) ENGINE=InnoDB;
ALTER TABLE articles ADD FULLTEXT INDEX (body) WITH PARSER simple_parser;
ERROR HY000: Cannot CREATE FULLTEXT INDEX WITH PARSER on InnoDB table
CREATE FULLTEXT INDEX ft_index ON articles(body) WITH PARSER simple_parser;
ERROR HY000: Cannot CREATE FULLTEXT INDEX WITH PARSER on InnoDB table
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql');
id title body
1 MySQL Tutorial DBMS stands for MySQL DataBase ...
2 How To Use MySQL Well After you went through a ...
3 Optimizing MySQL In this tutorial we will show ...
4 1001 MySQL Tricks How to use full-text search engine
5 Go MySQL Tricks How to use full text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('will go');
id title body
# Test plugin parser tokenizer difference
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full-text');
id title body
4 1001 MySQL Tricks How to use full-text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text');
id title body
5 Go MySQL Tricks How to use full text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE);
id title body
DROP TABLE articles;
# Test Part 3: Row Merge Create Index Test(ALTER TABLE ADD FULLTEXT INDEX)
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT
) ENGINE=InnoDB;
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
ALTER TABLE articles ADD FULLTEXT INDEX (title, body) WITH PARSER simple_parser;
Warnings:
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql');
id title body
1 MySQL Tutorial DBMS stands for MySQL DataBase ...
2 How To Use MySQL Well After you went through a ...
3 Optimizing MySQL In this tutorial we will show ...
4 1001 MySQL Tricks How to use full-text search engine
5 Go MySQL Tricks How to use full text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('will go');
id title body
# Test plugin parser tokenizer difference
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full-text');
id title body
4 1001 MySQL Tricks How to use full-text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text');
id title body
5 Go MySQL Tricks How to use full text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION);
id title body
4 1001 MySQL Tricks How to use full-text search engine
5 Go MySQL Tricks How to use full text search engine
2 How To Use MySQL Well After you went through a ...
1 MySQL Tutorial DBMS stands for MySQL DataBase ...
3 Optimizing MySQL In this tutorial we will show ...
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION);
id title body
5 Go MySQL Tricks How to use full text search engine
4 1001 MySQL Tricks How to use full-text search engine
2 How To Use MySQL Well After you went through a ...
1 MySQL Tutorial DBMS stands for MySQL DataBase ...
3 Optimizing MySQL In this tutorial we will show ...
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE);
id title body
DROP TABLE articles;
# Test Part 3 END
# Test Part 4:crash on commit(before/after)
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title, body) WITH PARSER simple_parser
) ENGINE=InnoDB;
BEGIN;
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
SELECT COUNT(*) FROM articles;
COUNT(*)
0
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql');
id title body
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('Tricks');
id title body
4 1001 MySQL Tricks How to use full-text search engine
5 Go MySQL Tricks How to use full text search engine
SELECT COUNT(*) FROM articles;
COUNT(*)
5
DROP TABLE articles;
# Test Part 5: Test Uninstall Plugin After Index is Built
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title, body) WITH PARSER simple_parser
) ENGINE=InnoDB;
UNINSTALL PLUGIN simple_parser;
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...');
ERROR HY000: Plugin 'simple_parser' is not loaded
INSTALL PLUGIN simple_parser SONAME 'mypluglib';
INSERT INTO articles (title, body) VALUES
('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','How to use full-text search engine'),
('Go MySQL Tricks','How to use full text search engine');
UNINSTALL PLUGIN simple_parser;
Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('mysql');
id title body
1 MySQL Tutorial DBMS stands for MySQL DataBase ...
2 How To Use MySQL Well After you went through a ...
3 Optimizing MySQL In this tutorial we will show ...
4 1001 MySQL Tricks How to use full-text search engine
5 Go MySQL Tricks How to use full text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('will go');
id title body
# Test plugin parser tokenizer difference
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full-text');
id title body
4 1001 MySQL Tricks How to use full-text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text');
id title body
5 Go MySQL Tricks How to use full text search engine
CREATE TABLE articles2 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title, body) WITH PARSER simple_parser
) ENGINE=InnoDB;
ERROR HY000: Function 'simple_parser' is not defined
DROP TABLE articles;
UNINSTALL PLUGIN simple_parser;
ERROR 42000: PLUGIN simple_parser does not exist
4 changes: 1 addition & 3 deletions mysql-test/suite/innodb_fts/r/innodb_fts_proximity.result
Expand Up @@ -128,7 +128,7 @@ WHERE MATCH (a,b)
AGAINST ('"mysql use"@1' IN BOOLEAN MODE);
id a b
INSERT INTO t1 (a,b) VALUES ('XYZ, long blob', repeat("a", 9000));
INSERT INTO t1 (a,b) VALUES (repeat("b", 9000), 'XYZ, long blob');
INSERT IGNORE INTO t1 (a,b) VALUES (repeat("b", 9000), 'XYZ, long blob');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
SELECT count(*) FROM t1
Expand All @@ -137,7 +137,6 @@ AGAINST ('"xyz blob"@3' IN BOOLEAN MODE);
count(*)
2
DROP TABLE t1;
set global innodb_file_format="Barracuda";
set global innodb_file_per_table=1;
CREATE TABLE t1 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
Expand Down Expand Up @@ -225,5 +224,4 @@ AGAINST ('"very blob"@3' IN BOOLEAN MODE);
count(*)
1
DROP TABLE t1;
SET GLOBAL innodb_file_format=Antelope;
SET GLOBAL innodb_file_per_table=1;
2 changes: 2 additions & 0 deletions mysql-test/suite/innodb_fts/t/innodb-fts-fic.test
Expand Up @@ -2,6 +2,8 @@

-- source include/have_innodb.inc

call mtr.add_suppression("\\[Warning\\] InnoDB: A new Doc ID must be supplied while updating FTS indexed columns.");
call mtr.add_suppression("\\[Warning\\] InnoDB: FTS Doc ID must be larger than [0-9]+ for table `test`.`articles`");
# Create FTS table
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
Expand Down

0 comments on commit ea3262d

Please sign in to comment.