summaryrefslogtreecommitdiff
path: root/mysql-test/suite
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-04-28 22:29:13 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-04-28 22:29:13 +0300
commit1fbdcada73c1861b85080eede95140296d6a3c20 (patch)
tree12c9dc1184ca62dcdee10e7916a44bc203799529 /mysql-test/suite
parentc755974775a7a7f4fc24abeacd2fc9ea7bf0c247 (diff)
parentdd5c307cb00bfde6c88bf125f61b3e0d85dc79a5 (diff)
downloadmariadb-git-1fbdcada73c1861b85080eede95140296d6a3c20.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'mysql-test/suite')
-rw-r--r--mysql-test/suite/innodb/r/innodb_sys_var_valgrind.result73
-rw-r--r--mysql-test/suite/innodb/t/innodb_sys_var_valgrind.test70
-rw-r--r--mysql-test/suite/innodb_fts/r/stopword.result744
-rw-r--r--mysql-test/suite/innodb_fts/t/stopword.opt1
-rw-r--r--mysql-test/suite/innodb_fts/t/stopword.test657
-rw-r--r--mysql-test/suite/innodb_gis/r/rtree_split.result56
-rw-r--r--mysql-test/suite/innodb_gis/t/rtree_split.test64
-rw-r--r--mysql-test/suite/mariabackup/backup_lock_wait_timeout.result11
-rw-r--r--mysql-test/suite/mariabackup/backup_lock_wait_timeout.test28
9 files changed, 1614 insertions, 90 deletions
diff --git a/mysql-test/suite/innodb/r/innodb_sys_var_valgrind.result b/mysql-test/suite/innodb/r/innodb_sys_var_valgrind.result
new file mode 100644
index 00000000000..32d87b4668a
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_sys_var_valgrind.result
@@ -0,0 +1,73 @@
+#
+# Bug #29717909 MEMORY LIFETIME OF VARIABLES BETWEEN CHECK AND UPDATE INCORRECTLY MANAGED
+#
+select @@innodb_ft_server_stopword_table;
+@@innodb_ft_server_stopword_table
+NULL
+create table user_stopword_1(value varchar(30)) engine = innodb;
+create table user_stopword_2(value varchar(30)) engine = innodb;
+set @blah = 'test/user_stopword_1';
+SET GLOBAL innodb_ft_server_stopword_table= @blah;
+select @@innodb_ft_server_stopword_table;
+@@innodb_ft_server_stopword_table
+test/user_stopword_1
+set @blah = 'test/user_stopword_2';
+SET GLOBAL innodb_ft_server_stopword_table= @blah;
+select @@innodb_ft_server_stopword_table;
+@@innodb_ft_server_stopword_table
+test/user_stopword_2
+SET GLOBAL innodb_ft_server_stopword_table= NULL;
+select @@innodb_ft_server_stopword_table;
+@@innodb_ft_server_stopword_table
+NULL
+SET GLOBAL innodb_ft_server_stopword_table= default;
+select @@innodb_ft_server_stopword_table;
+@@innodb_ft_server_stopword_table
+NULL
+drop table user_stopword_1, user_stopword_2;
+select @@innodb_buffer_pool_filename;
+@@innodb_buffer_pool_filename
+ib_buffer_pool
+set @blah='hello';
+set global innodb_buffer_pool_filename = @blah;
+select @@innodb_buffer_pool_filename;
+@@innodb_buffer_pool_filename
+hello
+set global innodb_buffer_pool_filename="bye";
+select @@innodb_buffer_pool_filename;
+@@innodb_buffer_pool_filename
+bye
+set global innodb_buffer_pool_filename=NULL;
+ERROR 42000: Variable 'innodb_buffer_pool_filename' can't be set to the value of 'NULL'
+select @@innodb_buffer_pool_filename;
+@@innodb_buffer_pool_filename
+bye
+set global innodb_buffer_pool_filename=default;
+select @@innodb_buffer_pool_filename;
+@@innodb_buffer_pool_filename
+ib_buffer_pool
+CREATE TABLE t1 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+opening_line TEXT(500), author VARCHAR(200), title VARCHAR(200), FULLTEXT idx
+(opening_line)) ENGINE=InnoDB;
+CREATE TABLE t2 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+opening_line TEXT(500), author VARCHAR(200), title VARCHAR(200), FULLTEXT idx
+(opening_line)) ENGINE=InnoDB;
+select @@innodb_ft_aux_table;
+@@innodb_ft_aux_table
+NULL
+set @blah = 'test/t1';
+SET GLOBAL innodb_ft_aux_table = @blah;
+select @@innodb_ft_aux_table;
+@@innodb_ft_aux_table
+test/t1
+set @blah = 'test/t2';
+SET GLOBAL innodb_ft_aux_table = @blah;
+SET GLOBAL innodb_ft_aux_table = NULL;
+select @@innodb_ft_aux_table;
+@@innodb_ft_aux_table
+NULL
+SET GLOBAL innodb_ft_aux_table =default;
+select @@innodb_ft_aux_table;
+@@innodb_ft_aux_table
+NULL
+drop table t1,t2;
diff --git a/mysql-test/suite/innodb/t/innodb_sys_var_valgrind.test b/mysql-test/suite/innodb/t/innodb_sys_var_valgrind.test
new file mode 100644
index 00000000000..2e1391355b9
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_sys_var_valgrind.test
@@ -0,0 +1,70 @@
+--source include/have_innodb.inc
+
+--echo #
+--echo # Bug #29717909 MEMORY LIFETIME OF VARIABLES BETWEEN CHECK AND UPDATE INCORRECTLY MANAGED
+--echo #
+
+#Test innodb_ft_server_stopword_table (global variable)
+select @@innodb_ft_server_stopword_table;
+create table user_stopword_1(value varchar(30)) engine = innodb;
+create table user_stopword_2(value varchar(30)) engine = innodb;
+
+set @blah = 'test/user_stopword_1';
+SET GLOBAL innodb_ft_server_stopword_table= @blah;
+select @@innodb_ft_server_stopword_table;
+
+set @blah = 'test/user_stopword_2';
+SET GLOBAL innodb_ft_server_stopword_table= @blah;
+select @@innodb_ft_server_stopword_table;
+
+SET GLOBAL innodb_ft_server_stopword_table= NULL;
+select @@innodb_ft_server_stopword_table;
+
+SET GLOBAL innodb_ft_server_stopword_table= default;
+select @@innodb_ft_server_stopword_table;
+
+drop table user_stopword_1, user_stopword_2;
+
+#Test innodb_buffer_pool_filename (global variable)
+
+select @@innodb_buffer_pool_filename;
+
+set @blah='hello';
+set global innodb_buffer_pool_filename = @blah;
+select @@innodb_buffer_pool_filename;
+
+set global innodb_buffer_pool_filename="bye";
+select @@innodb_buffer_pool_filename;
+
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_buffer_pool_filename=NULL;
+select @@innodb_buffer_pool_filename;
+
+set global innodb_buffer_pool_filename=default;
+select @@innodb_buffer_pool_filename;
+
+#Test innodb_ft_aux_table (global variable)
+CREATE TABLE t1 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+opening_line TEXT(500), author VARCHAR(200), title VARCHAR(200), FULLTEXT idx
+(opening_line)) ENGINE=InnoDB;
+
+CREATE TABLE t2 ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+opening_line TEXT(500), author VARCHAR(200), title VARCHAR(200), FULLTEXT idx
+(opening_line)) ENGINE=InnoDB;
+
+select @@innodb_ft_aux_table;
+
+set @blah = 'test/t1';
+SET GLOBAL innodb_ft_aux_table = @blah;
+select @@innodb_ft_aux_table;
+
+set @blah = 'test/t2';
+SET GLOBAL innodb_ft_aux_table = @blah;
+
+SET GLOBAL innodb_ft_aux_table = NULL;
+select @@innodb_ft_aux_table;
+
+SET GLOBAL innodb_ft_aux_table =default;
+select @@innodb_ft_aux_table;
+
+drop table t1,t2;
diff --git a/mysql-test/suite/innodb_fts/r/stopword.result b/mysql-test/suite/innodb_fts/r/stopword.result
new file mode 100644
index 00000000000..82679cb71c4
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/r/stopword.result
@@ -0,0 +1,744 @@
+call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table not_defined does not exist.");
+call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table test/user_stopword_session does not exist.");
+select * from information_schema.innodb_ft_default_stopword;
+value
+a
+about
+an
+are
+as
+at
+be
+by
+com
+de
+en
+for
+from
+how
+i
+in
+is
+it
+la
+of
+on
+or
+that
+the
+this
+to
+was
+what
+when
+where
+who
+will
+with
+und
+the
+www
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles (title,body) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...') ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('the' IN NATURAL LANGUAGE MODE);
+id title body
+SET @innodb_ft_server_stopword_table_orig=@@innodb_ft_server_stopword_table;
+SET @innodb_ft_enable_stopword_orig=@@innodb_ft_enable_stopword;
+SET @innodb_ft_user_stopword_table_orig=@@innodb_ft_user_stopword_table;
+set global innodb_ft_server_stopword_table = "not_defined";
+ERROR 42000: Variable 'innodb_ft_server_stopword_table' can't be set to the value of 'not_defined'
+set global innodb_ft_server_stopword_table = NULL;
+create table user_stopword(value varchar(30)) engine = innodb;
+set global innodb_ft_server_stopword_table = "test/user_stopword";
+drop index title on articles;
+create fulltext index idx on articles(title, body);
+SELECT * FROM articles WHERE MATCH (title,body)
+AGAINST ('the' IN NATURAL LANGUAGE MODE);
+id title body
+5 MySQL vs. YourSQL In the following database comparison ...
+CREATE TABLE articles_2 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles_2 (title, body)
+VALUES ('test for stopwords','this is it...');
+SELECT * FROM articles_2 WHERE MATCH (title,body)
+AGAINST ('this' IN NATURAL LANGUAGE MODE);
+id title body
+1 test for stopwords this is it...
+insert into user_stopword values("this");
+CREATE TABLE articles_3 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles_3 (title, body)
+VALUES ('test for stopwords','this is it...');
+SELECT * FROM articles_3 WHERE MATCH (title,body)
+AGAINST ('this' IN NATURAL LANGUAGE MODE);
+id title body
+create table user_stopword_session(value varchar(30)) engine = innodb;
+insert into user_stopword_session values("session");
+set session innodb_ft_user_stopword_table="test/user_stopword_session";
+CREATE TABLE articles_4 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles_4 (title, body)
+VALUES ('test for session stopwords','this should also be excluded...');
+SELECT * FROM articles_4 WHERE MATCH (title,body)
+AGAINST ('session' IN NATURAL LANGUAGE MODE);
+id title body
+SELECT * FROM articles_4 WHERE MATCH (title,body)
+AGAINST ('this' IN NATURAL LANGUAGE MODE);
+id title body
+1 test for session stopwords this should also be excluded...
+connect con1,localhost,root,,;
+CREATE TABLE articles_5 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles_5 (title, body)
+VALUES ('test for session stopwords','this should also be excluded...');
+SELECT * FROM articles_5 WHERE MATCH (title,body)
+AGAINST ('session' IN NATURAL LANGUAGE MODE);
+id title body
+1 test for session stopwords this should also be excluded...
+connection default;
+drop table articles;
+drop table articles_2;
+drop table articles_3;
+drop table articles_4;
+drop table articles_5;
+drop table user_stopword;
+drop table user_stopword_session;
+SET GLOBAL innodb_ft_enable_stopword=@innodb_ft_enable_stopword_orig;
+SET GLOBAL innodb_ft_server_stopword_table=default;
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT `idx` (title,body)
+) ENGINE=InnoDB;
+SHOW CREATE TABLE articles;
+Table Create Table
+articles CREATE TABLE `articles` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `title` varchar(200) DEFAULT NULL,
+ `body` text DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `idx` (`title`,`body`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO articles (title,body) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+('when To Use MySQL Well','After that you went through a ...'),
+('where will Optimizing MySQL','In what tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+id title body
+INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+id title body
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE id = 7;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id title body
+DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE id = 7;
+id title body
+7 update the record to see will is indexed or not
+DELETE FROM articles WHERE id = 7;
+SET global innodb_ft_server_stopword_table = NULL;
+SET SESSION innodb_ft_enable_stopword = 0;
+select @@innodb_ft_enable_stopword;
+@@innodb_ft_enable_stopword
+0
+SET global innodb_ft_user_stopword_table = NULL;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+id title body
+INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+id title body
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE id = 8;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id title body
+SELECT * FROM articles WHERE id = 8;
+id title body
+8 update the record to see will is indexed or not
+DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE id = 8;
+id title body
+8 update the record to see will is indexed or not
+DELETE FROM articles WHERE id = 8;
+ALTER TABLE articles DROP INDEX idx;
+SHOW CREATE TABLE articles;
+Table Create Table
+articles CREATE TABLE `articles` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `title` varchar(200) DEFAULT NULL,
+ `body` text DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+ANALYZE TABLE articles;
+Table Op Msg_type Msg_text
+test.articles analyze status OK
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+id title body
+2 when To Use MySQL Well After that you went through a ...
+6 MySQL Security When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+1 MySQL from Tutorial DBMS stands for DataBase ...
+6 MySQL Security When configured properly, MySQL ...
+2 when To Use MySQL Well After that you went through a ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+id title body
+2 when To Use MySQL Well After that you went through a ...
+3 where will Optimizing MySQL In what tutorial we will show ...
+6 MySQL Security When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+id title body
+1 MySQL from Tutorial DBMS stands for DataBase ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+id title body
+9 the record will not index the , will words
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+id title body
+9 the record will not index the , will words
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT COUNT(*),max(id) FROM articles;
+COUNT(*) max(id)
+7 9
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+id title body
+9 update the record to see will is indexed or not
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+9 update the record to see will is indexed or not
+DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE id = 9;
+id title body
+DROP TABLE articles;
+SET SESSION innodb_ft_enable_stopword=@innodb_ft_enable_stopword_orig;
+SET GLOBAL innodb_ft_server_stopword_table=@innodb_ft_server_stopword_table_orig;
+SET GLOBAL innodb_ft_user_stopword_table=@innodb_ft_user_stopword_table_orig;
+SET SESSION innodb_ft_user_stopword_table=default;
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT `idx` (title,body)
+) ENGINE=InnoDB;
+INSERT INTO articles (title,body) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+('when To Use MySQL Well','After that you went through a ...'),
+('where will Optimizing MySQL','In what tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id title body
+create table user_stopword(value varchar(30)) engine = innodb;
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+create table server_stopword(value varchar(30)) engine = innodb;
+set global innodb_ft_server_stopword_table = "test/server_stopword";
+insert into user_stopword values("this"),("will"),("the");
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id title body
+insert into server_stopword values("what"),("where");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+DELETE FROM user_stopword;
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+insert into user_stopword values("this"),("will"),("the");
+ALTER TABLE articles DROP INDEX idx;
+SET SESSION innodb_ft_enable_stopword = 0;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SET SESSION innodb_ft_enable_stopword = 1;
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id title body
+SET SESSION innodb_ft_enable_stopword = 1;
+SET SESSION innodb_ft_user_stopword_table = default;
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+DROP TABLE articles,user_stopword,server_stopword;
+SET innodb_ft_enable_stopword=@innodb_ft_enable_stopword_orig;
+SET GLOBAL innodb_ft_server_stopword_table=default;
+SET SESSION innodb_ft_user_stopword_table=default;
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT `idx` (title,body)
+) ENGINE=InnoDB;
+SHOW CREATE TABLE articles;
+Table Create Table
+articles CREATE TABLE `articles` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `title` varchar(200) DEFAULT NULL,
+ `body` text DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `idx` (`title`,`body`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO articles (title,body) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+('when To Use MySQL Well','After that you went through a ...'),
+('where will Optimizing MySQL','In what tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id title body
+create table user_stopword(value varchar(30)) engine = innodb;
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+insert into user_stopword values("mysqld"),("DBMS");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
+id title body
+1 MySQL from Tutorial DBMS stands for DataBase ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
+id title body
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
+id title body
+set session innodb_ft_user_stopword_table = default;
+create table server_stopword(value varchar(30)) engine = innodb;
+set global innodb_ft_server_stopword_table = "test/server_stopword";
+insert into server_stopword values("root"),("properly");
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
+id title body
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+set global innodb_ft_server_stopword_table = "test/server_stopword";
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
+id title body
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
+id title body
+6 MySQL Security When configured properly, MySQL ...
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+DELETE FROM user_stopword;
+set global innodb_ft_server_stopword_table = "test/server_stopword";
+DELETE FROM server_stopword;
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
+id title body
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
+id title body
+6 MySQL Security When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
+id title body
+1 MySQL from Tutorial DBMS stands for DataBase ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
+id title body
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+DROP TABLE articles,user_stopword,server_stopword;
+SET SESSION innodb_ft_enable_stopword=@innodb_ft_enable_stopword_orig;
+SET GLOBAL innodb_ft_server_stopword_table=default;
+SET SESSION innodb_ft_user_stopword_table=default;
+CREATE TABLE articles (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200),
+body TEXT,
+FULLTEXT `idx` (title,body)
+) ENGINE=InnoDB;
+SHOW CREATE TABLE articles;
+Table Create Table
+articles CREATE TABLE `articles` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `title` varchar(200) DEFAULT NULL,
+ `body` text DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ FULLTEXT KEY `idx` (`title`,`body`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO articles (title,body) VALUES
+('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+('when To Use MySQL Well','After that you went through a ...'),
+('where will Optimizing MySQL','In what tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+SET SESSION innodb_ft_enable_stopword = 0;
+select @@innodb_ft_enable_stopword;
+@@innodb_ft_enable_stopword
+0
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+"In connection 1"
+connection con1;
+select @@innodb_ft_enable_stopword;
+@@innodb_ft_enable_stopword
+1
+ANALYZE TABLE articles;
+Table Op Msg_type Msg_text
+test.articles analyze status OK
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+id title body
+2 when To Use MySQL Well After that you went through a ...
+6 MySQL Security When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+1 MySQL from Tutorial DBMS stands for DataBase ...
+6 MySQL Security When configured properly, MySQL ...
+2 when To Use MySQL Well After that you went through a ...
+4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
+5 MySQL vs. YourSQL In the following database comparison ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+id title body
+2 when To Use MySQL Well After that you went through a ...
+3 where will Optimizing MySQL In what tutorial we will show ...
+6 MySQL Security When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+id title body
+1 MySQL from Tutorial DBMS stands for DataBase ...
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SET SESSION innodb_ft_enable_stopword = 1;
+select @@innodb_ft_enable_stopword;
+@@innodb_ft_enable_stopword
+1
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+id title body
+"In connection default"
+connection default;
+select @@innodb_ft_enable_stopword;
+@@innodb_ft_enable_stopword
+0
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+id title body
+INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+id title body
+SET SESSION innodb_ft_enable_stopword = 1;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+id title body
+"In connection 1"
+connection con1;
+SET SESSION innodb_ft_enable_stopword = 1;
+create table user_stopword(value varchar(30)) engine = innodb;
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+insert into user_stopword values("this"),("will"),("the");
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id title body
+"In connection default"
+connection default;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+id title body
+select @@innodb_ft_user_stopword_table;
+@@innodb_ft_user_stopword_table
+NULL
+create table user_stopword_1(value varchar(30)) engine = innodb;
+set session innodb_ft_user_stopword_table = "test/user_stopword_1";
+insert into user_stopword_1 values("when");
+SET SESSION innodb_ft_enable_stopword = 1;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
+id title body
+2 when To Use MySQL Well After that you went through a ...
+6 MySQL Security When configured properly, MySQL ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when');
+id title body
+2 when To Use MySQL Well After that you went through a ...
+6 MySQL Security When configured properly, MySQL ...
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when');
+id title body
+"In connection 1"
+connection con1;
+SET SESSION innodb_ft_enable_stopword = 1;
+SET SESSION innodb_ft_user_stopword_table=default;
+select @@innodb_ft_user_stopword_table;
+@@innodb_ft_user_stopword_table
+NULL
+select @@innodb_ft_server_stopword_table;
+@@innodb_ft_server_stopword_table
+NULL
+create table server_stopword(value varchar(30)) engine = innodb;
+SET GLOBAL innodb_ft_server_stopword_table = "test/server_stopword";
+select @@innodb_ft_server_stopword_table;
+@@innodb_ft_server_stopword_table
+test/server_stopword
+insert into server_stopword values("when"),("the");
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the');
+id title body
+disconnect con1;
+"In connection default"
+connection default;
+SET SESSION innodb_ft_enable_stopword = 1;
+SET SESSION innodb_ft_user_stopword_table=default;
+select @@innodb_ft_server_stopword_table;
+@@innodb_ft_server_stopword_table
+test/server_stopword
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+insert into server_stopword values("where"),("will");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
+id title body
+3 where will Optimizing MySQL In what tutorial we will show ...
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the');
+id title body
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
+id title body
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
+id title body
+DROP TABLE articles,user_stopword,user_stopword_1,server_stopword;
+SET GLOBAL innodb_ft_user_stopword_table=@innodb_ft_user_stopword_table_orig;
+SET GLOBAL innodb_ft_server_stopword_table=@innodb_ft_server_stopword_table_orig;
diff --git a/mysql-test/suite/innodb_fts/t/stopword.opt b/mysql-test/suite/innodb_fts/t/stopword.opt
new file mode 100644
index 00000000000..d6938c3b1ea
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/t/stopword.opt
@@ -0,0 +1 @@
+--innodb-ft-default-stopword
diff --git a/mysql-test/suite/innodb_fts/t/stopword.test b/mysql-test/suite/innodb_fts/t/stopword.test
new file mode 100644
index 00000000000..5105a6d2fec
--- /dev/null
+++ b/mysql-test/suite/innodb_fts/t/stopword.test
@@ -0,0 +1,657 @@
+# This is the basic function tests for innodb FTS
+
+-- source include/have_innodb.inc
+
+call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table not_defined does not exist.");
+call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table test/user_stopword_session does not exist.");
+
+select * from information_schema.innodb_ft_default_stopword;
+
+# Create FTS table
+CREATE TABLE articles (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT (title,body)
+ ) ENGINE=InnoDB;
+
+# Insert six rows
+INSERT INTO articles (title,body) VALUES
+ ('MySQL Tutorial','DBMS stands for DataBase ...') ,
+ ('How To Use MySQL Well','After you went through a ...'),
+ ('Optimizing MySQL','In this tutorial we will show ...'),
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL','In the following database comparison ...'),
+ ('MySQL Security','When configured properly, MySQL ...');
+
+# "the" is in the default stopword, it would not be selected
+SELECT * FROM articles WHERE MATCH (title,body)
+ AGAINST ('the' IN NATURAL LANGUAGE MODE);
+
+SET @innodb_ft_server_stopword_table_orig=@@innodb_ft_server_stopword_table;
+SET @innodb_ft_enable_stopword_orig=@@innodb_ft_enable_stopword;
+SET @innodb_ft_user_stopword_table_orig=@@innodb_ft_user_stopword_table;
+
+# Provide user defined stopword table, if not (correctly) defined,
+# it will be rejected
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_ft_server_stopword_table = "not_defined";
+set global innodb_ft_server_stopword_table = NULL;
+
+# Define a correct formated user stopword table
+create table user_stopword(value varchar(30)) engine = innodb;
+
+# The set operation should be successful
+set global innodb_ft_server_stopword_table = "test/user_stopword";
+
+drop index title on articles;
+
+create fulltext index idx on articles(title, body);
+
+# Now we should be able to find "the"
+SELECT * FROM articles WHERE MATCH (title,body)
+ AGAINST ('the' IN NATURAL LANGUAGE MODE);
+
+# Nothing inserted into the default stopword, so essentially
+# nothing get screened. The new stopword could only be
+# effective for table created thereafter
+CREATE TABLE articles_2 (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT (title,body)
+ ) ENGINE=InnoDB;
+
+INSERT INTO articles_2 (title, body)
+ VALUES ('test for stopwords','this is it...');
+
+# Now we can find record with "this"
+SELECT * FROM articles_2 WHERE MATCH (title,body)
+ AGAINST ('this' IN NATURAL LANGUAGE MODE);
+
+# Ok, let's instantiate some value into user supplied stop word
+# table
+insert into user_stopword values("this");
+
+# Ok, let's repeat with the new table again.
+CREATE TABLE articles_3 (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT (title,body)
+ ) ENGINE=InnoDB;
+
+INSERT INTO articles_3 (title, body)
+ VALUES ('test for stopwords','this is it...');
+
+# Now we should NOT find record with "this"
+SELECT * FROM articles_3 WHERE MATCH (title,body)
+ AGAINST ('this' IN NATURAL LANGUAGE MODE);
+
+# Test session level stopword control "innodb_user_stopword_table"
+create table user_stopword_session(value varchar(30)) engine = innodb;
+
+insert into user_stopword_session values("session");
+
+set session innodb_ft_user_stopword_table="test/user_stopword_session";
+
+CREATE TABLE articles_4 (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT (title,body)
+ ) ENGINE=InnoDB;
+
+INSERT INTO articles_4 (title, body)
+ VALUES ('test for session stopwords','this should also be excluded...');
+
+# "session" is excluded
+SELECT * FROM articles_4 WHERE MATCH (title,body)
+ AGAINST ('session' IN NATURAL LANGUAGE MODE);
+
+# But we can find record with "this"
+SELECT * FROM articles_4 WHERE MATCH (title,body)
+ AGAINST ('this' IN NATURAL LANGUAGE MODE);
+
+--connect (con1,localhost,root,,)
+CREATE TABLE articles_5 (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT (title,body)
+ ) ENGINE=InnoDB;
+
+INSERT INTO articles_5 (title, body)
+ VALUES ('test for session stopwords','this should also be excluded...');
+
+# "session" should be found since the stopword table is session specific
+SELECT * FROM articles_5 WHERE MATCH (title,body)
+ AGAINST ('session' IN NATURAL LANGUAGE MODE);
+
+--connection default
+drop table articles;
+drop table articles_2;
+drop table articles_3;
+drop table articles_4;
+drop table articles_5;
+drop table user_stopword;
+drop table user_stopword_session;
+
+SET GLOBAL innodb_ft_enable_stopword=@innodb_ft_enable_stopword_orig;
+SET GLOBAL innodb_ft_server_stopword_table=default;
+
+#---------------------------------------------------------------------------------------
+# Behavior :
+# The stopword is loaded into memory at
+# 1) create fulltext index time,
+# 2) boot server,
+# 3) first time FTs is used
+# So if you already created a FTS index, and then turn off stopword
+# or change stopword table content it won't affect the FTS
+# that already created since the stopword list are already loaded.
+# It will only affect the new FTS index created after you changed
+# the settings.
+
+# Create FTS table
+CREATE TABLE articles (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT `idx` (title,body)
+ ) ENGINE=InnoDB;
+
+SHOW CREATE TABLE articles;
+
+# Insert six rows
+INSERT INTO articles (title,body) VALUES
+ ('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+ ('when To Use MySQL Well','After that you went through a ...'),
+ ('where will Optimizing MySQL','In what tutorial we will show ...'),
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL','In the following database comparison ...'),
+ ('MySQL Security','When configured properly, MySQL ...');
+
+# Case : server_stopword=default
+# Try to Search default stopword from innodb, "where", "will", "what"
+# and "when" are all stopwords
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+# boolean No result expected
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+# no result expected
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+# no result expected
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+
+INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+# Not going to update as where condition can not find record
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+# Update the record
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE id = 7;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+# Delete will not work as where condition do not return
+DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE id = 7;
+DELETE FROM articles WHERE id = 7;
+
+
+
+# Case : Turn OFF stopword list variable and search stopword on OLD index.
+# disable stopword list
+SET global innodb_ft_server_stopword_table = NULL;
+SET SESSION innodb_ft_enable_stopword = 0;
+select @@innodb_ft_enable_stopword;
+SET global innodb_ft_user_stopword_table = NULL;
+
+# search default stopword with innodb_ft_enable_stopword is OFF.
+# No records expected even though we turned OFF stopwod filtering
+# (refer Behavior (at the top of the test) for explanation )
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+
+INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+# Not going to update as where condition can not find record
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+# Update the record
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE id = 8;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+SELECT * FROM articles WHERE id = 8;
+# Delete will not work as where condition do not return
+DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE id = 8;
+DELETE FROM articles WHERE id = 8;
+
+# Case : Turn OFF stopword list variable and search stopword on NEW index.
+# Drop index
+ALTER TABLE articles DROP INDEX idx;
+SHOW CREATE TABLE articles;
+
+# Create the FTS index Using Alter Table.
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+
+ANALYZE TABLE articles;
+
+# search default stopword with innodb_ft_enable_stopword is OFF.
+# All records expected as stopwod filtering is OFF and we created
+# new FTS index.
+# (refer Behavior (at the top of the test) for explanation )
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+
+INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+# Update will succeed.
+UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+
+SELECT COUNT(*),max(id) FROM articles;
+# Update the record - uncommet on fix
+#UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
+#WHERE id = 9;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+# Delete will succeed.
+DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE id = 9;
+
+
+DROP TABLE articles;
+
+SET SESSION innodb_ft_enable_stopword=@innodb_ft_enable_stopword_orig;
+SET GLOBAL innodb_ft_server_stopword_table=@innodb_ft_server_stopword_table_orig;
+SET GLOBAL innodb_ft_user_stopword_table=@innodb_ft_user_stopword_table_orig;
+SET SESSION innodb_ft_user_stopword_table=default;
+
+# Create FTS table
+CREATE TABLE articles (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT `idx` (title,body)
+ ) ENGINE=InnoDB;
+
+# Insert six rows
+INSERT INTO articles (title,body) VALUES
+ ('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+ ('when To Use MySQL Well','After that you went through a ...'),
+ ('where will Optimizing MySQL','In what tutorial we will show ...'),
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL','In the following database comparison ...'),
+ ('MySQL Security','When configured properly, MySQL ...');
+
+# No records expeced for select
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+# Define a correct formated user stopword table
+create table user_stopword(value varchar(30)) engine = innodb;
+# The set operation should be successful
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+# Define a correct formated server stopword table
+create table server_stopword(value varchar(30)) engine = innodb;
+# The set operation should be successful
+set global innodb_ft_server_stopword_table = "test/server_stopword";
+# Add values into user supplied stop word table
+insert into user_stopword values("this"),("will"),("the");
+
+# Drop existing index and create the FTS index Using Alter Table.
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+
+# Add values into server supplied stop word table
+insert into server_stopword values("what"),("where");
+# Follwoing should return result as server stopword list was empty at create index time
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+
+# Delete stopword from user list
+DELETE FROM user_stopword;
+# Drop existing index and create the FTS index Using Alter Table.
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+# Follwoing should return result even though to server stopword list
+# conatin these words. Session level stopword list takes priority
+# Here user_stopword is set using innodb_ft_user_stopword_table
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+
+# Follwoing should return result as user stopword list was empty at create index time
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+
+# Add values into user supplied stop word table
+insert into user_stopword values("this"),("will"),("the");
+
+# Drop existing index and create the FTS index Using Alter Table.
+ALTER TABLE articles DROP INDEX idx;
+SET SESSION innodb_ft_enable_stopword = 0;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+
+# Session level stopword list takes priority
+SET SESSION innodb_ft_enable_stopword = 1;
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+
+# Make user stopword list deafult so as to server stopword list takes priority
+SET SESSION innodb_ft_enable_stopword = 1;
+SET SESSION innodb_ft_user_stopword_table = default;
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+
+
+DROP TABLE articles,user_stopword,server_stopword;
+
+# Restore Defaults
+SET innodb_ft_enable_stopword=@innodb_ft_enable_stopword_orig;
+SET GLOBAL innodb_ft_server_stopword_table=default;
+SET SESSION innodb_ft_user_stopword_table=default;
+
+#---------------------------------------------------------------------------------------
+# Create FTS table
+CREATE TABLE articles (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT `idx` (title,body)
+ ) ENGINE=InnoDB;
+
+SHOW CREATE TABLE articles;
+
+# Insert six rows
+INSERT INTO articles (title,body) VALUES
+ ('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+ ('when To Use MySQL Well','After that you went through a ...'),
+ ('where will Optimizing MySQL','In what tutorial we will show ...'),
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL','In the following database comparison ...'),
+ ('MySQL Security','When configured properly, MySQL ...');
+
+# No records expeced for select
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+# Define a correct formated user stopword table
+create table user_stopword(value varchar(30)) engine = innodb;
+# The set operation should be successful
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+insert into user_stopword values("mysqld"),("DBMS");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
+
+
+# Drop existing index and create the FTS index Using Alter Table.
+# user stopword list will take effect.
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
+
+# set user stopword list empty
+set session innodb_ft_user_stopword_table = default;
+# Define a correct formated user stopword table
+create table server_stopword(value varchar(30)) engine = innodb;
+# The set operation should be successful
+set global innodb_ft_server_stopword_table = "test/server_stopword";
+insert into server_stopword values("root"),("properly");
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
+
+
+# set user stopword list empty
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+# The set operation should be successful
+set global innodb_ft_server_stopword_table = "test/server_stopword";
+# user stopword list take effect as its session level
+# Result expected for select
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
+
+# set user stopword list
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+DELETE FROM user_stopword;
+# The set operation should be successful
+set global innodb_ft_server_stopword_table = "test/server_stopword";
+DELETE FROM server_stopword;
+# user stopword list take affect as its session level
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
+
+DROP TABLE articles,user_stopword,server_stopword;
+
+# Restore Values
+SET SESSION innodb_ft_enable_stopword=@innodb_ft_enable_stopword_orig;
+SET GLOBAL innodb_ft_server_stopword_table=default;
+SET SESSION innodb_ft_user_stopword_table=default;
+
+
+#------------------------------------------------------------------------------
+# FTS stopword list test - check varaibles across sessions
+
+# Create FTS table
+CREATE TABLE articles (
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200),
+ body TEXT,
+ FULLTEXT `idx` (title,body)
+ ) ENGINE=InnoDB;
+
+SHOW CREATE TABLE articles;
+
+# Insert six rows
+INSERT INTO articles (title,body) VALUES
+ ('MySQL from Tutorial','DBMS stands for DataBase ...') ,
+ ('when To Use MySQL Well','After that you went through a ...'),
+ ('where will Optimizing MySQL','In what tutorial we will show ...'),
+ ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+ ('MySQL vs. YourSQL','In the following database comparison ...'),
+ ('MySQL Security','When configured properly, MySQL ...');
+
+# session varaible innodb_ft_enable_stopword=0 will take effect for new FTS index
+SET SESSION innodb_ft_enable_stopword = 0;
+select @@innodb_ft_enable_stopword;
+
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+
+
+--echo "In connection 1"
+--connection con1
+select @@innodb_ft_enable_stopword;
+
+ANALYZE TABLE articles;
+
+# result expected as index created before setting innodb_ft_enable_stopword varaible off
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+
+SET SESSION innodb_ft_enable_stopword = 1;
+select @@innodb_ft_enable_stopword;
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+# no result expected turned innodb_ft_enable_stopword is ON
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+
+
+--echo "In connection default"
+--connection default
+select @@innodb_ft_enable_stopword;
+# no result expected as word not indexed from connection 1
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
+
+INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+
+SET SESSION innodb_ft_enable_stopword = 1;
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
+
+
+--echo "In connection 1"
+--connection con1
+SET SESSION innodb_ft_enable_stopword = 1;
+# Define a correct formated user stopword table
+create table user_stopword(value varchar(30)) engine = innodb;
+# The set operation should be successful
+set session innodb_ft_user_stopword_table = "test/user_stopword";
+# Add values into user supplied stop word table
+insert into user_stopword values("this"),("will"),("the");
+# Drop existing index and create the FTS index Using Alter Table.
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+# no result expected as innodb_ft_user_stopword_table filter it
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+
+
+--echo "In connection default"
+--connection default
+# no result expected as innodb_ft_user_stopword_table filter it from connection1
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
+select @@innodb_ft_user_stopword_table;
+# Define a correct formated user stopword table
+create table user_stopword_1(value varchar(30)) engine = innodb;
+# The set operation should be successful
+set session innodb_ft_user_stopword_table = "test/user_stopword_1";
+insert into user_stopword_1 values("when");
+SET SESSION innodb_ft_enable_stopword = 1;
+# result expected
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when');
+# Drop existing index and create the FTS index Using Alter Table.
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+# no result expected
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when');
+
+--echo "In connection 1"
+--connection con1
+SET SESSION innodb_ft_enable_stopword = 1;
+SET SESSION innodb_ft_user_stopword_table=default;
+select @@innodb_ft_user_stopword_table;
+select @@innodb_ft_server_stopword_table;
+# Define a correct formated server stopword table
+create table server_stopword(value varchar(30)) engine = innodb;
+# The set operation should be successful
+SET GLOBAL innodb_ft_server_stopword_table = "test/server_stopword";
+select @@innodb_ft_server_stopword_table;
+insert into server_stopword values("when"),("the");
+# Drop existing index and create the FTS index Using Alter Table.
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+# no result expected
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the');
+
+disconnect con1;
+--source include/wait_until_disconnected.inc
+
+--echo "In connection default"
+--connection default
+SET SESSION innodb_ft_enable_stopword = 1;
+SET SESSION innodb_ft_user_stopword_table=default;
+select @@innodb_ft_server_stopword_table;
+# result expected
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
+insert into server_stopword values("where"),("will");
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
+ALTER TABLE articles DROP INDEX idx;
+ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
+# no result expected
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the');
+SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
+SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
+
+
+DROP TABLE articles,user_stopword,user_stopword_1,server_stopword;
+
+# Restore Values
+SET GLOBAL innodb_ft_user_stopword_table=@innodb_ft_user_stopword_table_orig;
+SET GLOBAL innodb_ft_server_stopword_table=@innodb_ft_server_stopword_table_orig;
diff --git a/mysql-test/suite/innodb_gis/r/rtree_split.result b/mysql-test/suite/innodb_gis/r/rtree_split.result
index 518319ff3d6..df88960ba3d 100644
--- a/mysql-test/suite/innodb_gis/r/rtree_split.result
+++ b/mysql-test/suite/innodb_gis/r/rtree_split.result
@@ -1,52 +1,24 @@
create table t1 (c1 int, c2 geometry not null, spatial index (c2))engine=innodb;
-insert into t1 values(1, Point(1,1));
-insert into t1 values(2, Point(2,2));
-insert into t1 values(3, Point(3,3));
-insert into t1 values(4, Point(4,4));
-insert into t1 values(5, Point(5,5));
-insert into t1 values(6, Point(6,6));
-insert into t1 values(7, Point(7,7));
-insert into t1 values(8, Point(8,8));
-insert into t1 values(9, Point(9,9));
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
+begin;
+insert into t1 select @s:=1+(seq mod 9), point(@s, @s)
+from seq_1_to_576;
SET @saved_dbug = @@SESSION.debug_dbug;
-SET debug_dbug = '+d, rtr_page_need_second_split';
-insert into t1 select * from t1;
+SET debug_dbug = '+d,rtr_page_need_second_split';
+insert into t1 select @s:=1+(seq mod 9), point(@s, @s)
+from seq_1_to_576;
SET debug_dbug = @saved_dbug;
-delete from t1;
-insert into t1 values(1, Point(1,1));
-insert into t1 values(2, Point(2,2));
-insert into t1 values(3, Point(3,3));
-insert into t1 values(4, Point(4,4));
-insert into t1 values(5, Point(5,5));
-insert into t1 values(6, Point(6,6));
-insert into t1 values(7, Point(7,7));
-insert into t1 values(8, Point(8,8));
-insert into t1 values(9, Point(9,9));
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-start transaction;
-insert into t1 select * from t1;
+rollback;
+insert into t1 select @s:=1+(seq mod 9), point(@s, @s)
+from seq_1_to_2304;
+begin;
+insert into t1 select @s:=1+(seq mod 9), point(@s, @s)
+from seq_1_to_2304;
rollback;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
+insert into t1 select @s:=1+(seq mod 9), point(@s, @s)
+from seq_1_to_71424;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
diff --git a/mysql-test/suite/innodb_gis/t/rtree_split.test b/mysql-test/suite/innodb_gis/t/rtree_split.test
index caf79becbd0..af626dba6b7 100644
--- a/mysql-test/suite/innodb_gis/t/rtree_split.test
+++ b/mysql-test/suite/innodb_gis/t/rtree_split.test
@@ -1,5 +1,5 @@
# WL#6745 InnoDB R-tree support
-# This test case will test R-tree split, mostly on duplciate records.
+# This test case will test R-tree split, mostly on duplicate records.
# Not supported in embedded
--source include/not_embedded.inc
@@ -8,65 +8,33 @@
--source include/big_test.inc
--source include/not_valgrind.inc
--source include/have_debug.inc
+--source include/have_sequence.inc
# Create table with R-tree index.
create table t1 (c1 int, c2 geometry not null, spatial index (c2))engine=innodb;
+begin;
# Insert enough values to let R-tree split.
-insert into t1 values(1, Point(1,1));
-insert into t1 values(2, Point(2,2));
-insert into t1 values(3, Point(3,3));
-insert into t1 values(4, Point(4,4));
-insert into t1 values(5, Point(5,5));
-insert into t1 values(6, Point(6,6));
-insert into t1 values(7, Point(7,7));
-insert into t1 values(8, Point(8,8));
-insert into t1 values(9, Point(9,9));
-
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
+insert into t1 select @s:=1+(seq mod 9), point(@s, @s)
+from seq_1_to_576;
#Check second round spliting.
SET @saved_dbug = @@SESSION.debug_dbug;
-SET debug_dbug = '+d, rtr_page_need_second_split';
-insert into t1 select * from t1;
+SET debug_dbug = '+d,rtr_page_need_second_split';
+insert into t1 select @s:=1+(seq mod 9), point(@s, @s)
+from seq_1_to_576;
SET debug_dbug = @saved_dbug;
+rollback;
-delete from t1;
-
-insert into t1 values(1, Point(1,1));
-insert into t1 values(2, Point(2,2));
-insert into t1 values(3, Point(3,3));
-insert into t1 values(4, Point(4,4));
-insert into t1 values(5, Point(5,5));
-insert into t1 values(6, Point(6,6));
-insert into t1 values(7, Point(7,7));
-insert into t1 values(8, Point(8,8));
-insert into t1 values(9, Point(9,9));
-
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-start transaction;
-insert into t1 select * from t1;
+insert into t1 select @s:=1+(seq mod 9), point(@s, @s)
+from seq_1_to_2304;
+begin;
+insert into t1 select @s:=1+(seq mod 9), point(@s, @s)
+from seq_1_to_2304;
rollback;
check table t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
+insert into t1 select @s:=1+(seq mod 9), point(@s, @s)
+from seq_1_to_71424;
check table t1;
select count(*) from t1;
diff --git a/mysql-test/suite/mariabackup/backup_lock_wait_timeout.result b/mysql-test/suite/mariabackup/backup_lock_wait_timeout.result
new file mode 100644
index 00000000000..9806bc29b47
--- /dev/null
+++ b/mysql-test/suite/mariabackup/backup_lock_wait_timeout.result
@@ -0,0 +1,11 @@
+CREATE TABLE t(i INT) ENGINE INNODB;
+connect con1,localhost,root,,;
+BEGIN;
+LOCK TABLES t WRITE;
+connection default;
+# xtrabackup backup
+connection con1;
+COMMIT;
+connection default;
+disconnect con1;
+DROP TABLE t;
diff --git a/mysql-test/suite/mariabackup/backup_lock_wait_timeout.test b/mysql-test/suite/mariabackup/backup_lock_wait_timeout.test
new file mode 100644
index 00000000000..e0f43910ef6
--- /dev/null
+++ b/mysql-test/suite/mariabackup/backup_lock_wait_timeout.test
@@ -0,0 +1,28 @@
+--source include/have_innodb.inc
+--source include/count_sessions.inc
+
+CREATE TABLE t(i INT) ENGINE INNODB;
+
+connect (con1,localhost,root,,);
+BEGIN;
+LOCK TABLES t WRITE;
+
+--connection default
+
+echo # xtrabackup backup;
+let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
+
+--disable_result_log
+--error 1
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --ftwrl-wait-timeout=1 --target-dir=$targetdir;
+--enable_result_log
+
+--connection con1
+COMMIT;
+
+--connection default
+--disconnect con1
+
+DROP TABLE t;
+rmdir $targetdir;
+--source include/wait_until_count_sessions.inc