mirror of
https://github.com/MariaDB/server.git
synced 2026-05-08 08:04:29 +02:00
Adjust the innodb_fts.sync and innodb_fts.sync_block tests for MariaDB
This commit is contained in:
parent
4136288705
commit
b4f104c9f0
5 changed files with 80 additions and 53 deletions
|
|
@ -1,3 +1,5 @@
|
|||
connect con1,localhost,root,,;
|
||||
connection default;
|
||||
# Case 1: Test select and insert(row in both disk and cache)
|
||||
CREATE TABLE t1 (
|
||||
FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
|
|
@ -6,9 +8,12 @@ FULLTEXT(title)
|
|||
) ENGINE = InnoDB;
|
||||
INSERT INTO t1(title) VALUES('mysql');
|
||||
INSERT INTO t1(title) VALUES('database');
|
||||
SET SESSION debug="+d,fts_instrument_sync_debug";
|
||||
connection con1;
|
||||
SET @old_dbug = @@SESSION.debug_dbug;
|
||||
SET debug_dbug = '+d,fts_instrument_sync_debug';
|
||||
SET DEBUG_SYNC= 'fts_write_node SIGNAL written WAIT_FOR selected';
|
||||
INSERT INTO t1(title) VALUES('mysql database');
|
||||
connection default;
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR written';
|
||||
SET GLOBAL innodb_ft_aux_table="test/t1";
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
|
||||
|
|
@ -25,8 +30,8 @@ FTS_DOC_ID title
|
|||
1 mysql
|
||||
2 database
|
||||
SET DEBUG_SYNC= 'now SIGNAL selected';
|
||||
/* connection con1 */ INSERT INTO t1(title) VALUES('mysql database');
|
||||
SET SESSION debug="-d,fts_instrument_sync_debug";
|
||||
connection con1;
|
||||
SET @old_dbug = @@SESSION.debug_dbug;
|
||||
SET GLOBAL innodb_ft_aux_table="test/t1";
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
|
||||
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
|
||||
|
|
@ -42,6 +47,7 @@ FTS_DOC_ID title
|
|||
3 mysql database
|
||||
1 mysql
|
||||
2 database
|
||||
connection default;
|
||||
DROP TABLE t1;
|
||||
# Case 2: Test insert and insert(sync)
|
||||
CREATE TABLE t1 (
|
||||
|
|
@ -51,14 +57,16 @@ FULLTEXT(title)
|
|||
) ENGINE = InnoDB;
|
||||
INSERT INTO t1(title) VALUES('mysql');
|
||||
INSERT INTO t1(title) VALUES('database');
|
||||
SET SESSION debug="+d,fts_instrument_sync_debug";
|
||||
connection con1;
|
||||
SET debug_dbug = '+d,fts_instrument_sync_debug';
|
||||
SET DEBUG_SYNC= 'fts_write_node SIGNAL written WAIT_FOR inserted';
|
||||
INSERT INTO t1(title) VALUES('mysql database');
|
||||
connection default;
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR written';
|
||||
INSERT INTO t1(title) VALUES('mysql database');
|
||||
SET DEBUG_SYNC= 'now SIGNAL inserted';
|
||||
/* connection con1 */ INSERT INTO t1(title) VALUES('mysql database');
|
||||
SET SESSION debug="-d,fts_instrument_sync_debug";
|
||||
connection con1;
|
||||
SET debug_dbug = @old_dbug;
|
||||
SET GLOBAL innodb_ft_aux_table="test/t1";
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
|
||||
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
|
||||
|
|
@ -77,6 +85,8 @@ FTS_DOC_ID title
|
|||
4 mysql database
|
||||
1 mysql
|
||||
2 database
|
||||
connection default;
|
||||
disconnect con1;
|
||||
DROP TABLE t1;
|
||||
# Case 3: Test insert crash recovery
|
||||
CREATE TABLE t1 (
|
||||
|
|
@ -85,17 +95,17 @@ title VARCHAR(200),
|
|||
FULLTEXT(title)
|
||||
) ENGINE = InnoDB;
|
||||
INSERT INTO t1(title) VALUES('database');
|
||||
SET SESSION debug="+d,fts_instrument_sync_debug,fts_write_node_crash";
|
||||
SET debug_dbug = '+d,fts_instrument_sync_debug,fts_write_node_crash';
|
||||
INSERT INTO t1(title) VALUES('mysql');
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
# restart
|
||||
After restart
|
||||
SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
|
||||
FTS_DOC_ID title
|
||||
1 database
|
||||
SET SESSION debug="+d,fts_instrument_sync_debug";
|
||||
SET @old_dbug = @@SESSION.debug_dbug;
|
||||
SET debug_dbug = '+d,fts_instrument_sync_debug';
|
||||
INSERT INTO t1(title) VALUES('mysql');
|
||||
SET SESSION debug="-d,fts_instrument_sync_debug";
|
||||
SET debug_dbug = @old_dbug;
|
||||
SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
|
||||
FTS_DOC_ID title
|
||||
1 database
|
||||
|
|
@ -107,22 +117,23 @@ id INT AUTO_INCREMENT,
|
|||
title VARCHAR(100),
|
||||
FULLTEXT(title),
|
||||
PRIMARY KEY(id)) ENGINE=InnoDB;
|
||||
SET SESSION debug="+d,fts_instrument_sync";
|
||||
SET debug_dbug = '+d,fts_instrument_sync';
|
||||
INSERT INTO t1(title) VALUES('mysql');
|
||||
SET SESSION debug="-d,fts_instrument_sync";
|
||||
# restart
|
||||
SET GLOBAL debug="+d,fts_instrument_sync,fts_instrument_sync_interrupted";
|
||||
SET debug_dbug = @old_dbug;
|
||||
SET @old_global_dbug = @@GLOBAL.debug_dbug;
|
||||
SET @old_dbug = @@SESSION.debug_dbug;
|
||||
SET GLOBAL debug_dbug='+d,fts_instrument_sync,fts_instrument_sync_interrupted';
|
||||
INSERT INTO t1(title) VALUES('database');
|
||||
SET GLOBAL debug="-d,fts_instrument_sync,fts_instrument_sync_interrupted";
|
||||
SET SESSION debug="+d,fts_instrument_sync_debug";
|
||||
SET GLOBAL debug_dbug = @old_global_dbug;
|
||||
SET debug_dbug = '+d,fts_instrument_sync_debug';
|
||||
INSERT INTO t1(title) VALUES('good');
|
||||
SET SESSION debug="-d,fts_instrument_sync_debug";
|
||||
SET debug_dbug = @old_dbug;
|
||||
SET GLOBAL innodb_ft_aux_table="test/t1";
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
|
||||
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
|
||||
database 4 4 1 4 0
|
||||
good 5 5 1 5 0
|
||||
mysql 2 2 1 2 0
|
||||
database 2 2 1 2 0
|
||||
good 3 3 1 3 0
|
||||
mysql 1 1 1 1 0
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
|
||||
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
|
||||
SET GLOBAL innodb_ft_aux_table=default;
|
||||
|
|
|
|||
|
|
@ -2,27 +2,35 @@ SET @old_log_output = @@global.log_output;
|
|||
SET @old_slow_query_log = @@global.slow_query_log;
|
||||
SET @old_general_log = @@global.general_log;
|
||||
SET @old_long_query_time = @@global.long_query_time;
|
||||
SET @old_binlog_order_commits = @@global.binlog_order_commits;
|
||||
SET @old_debug = @@global.debug_dbug;
|
||||
SET GLOBAL log_output = 'TABLE';
|
||||
SET GLOBAL general_log = 1;
|
||||
SET GLOBAL slow_query_log = 1;
|
||||
SET GLOBAL long_query_time = 1;
|
||||
SET GLOBAL binlog_order_commits = 1;
|
||||
connect con1,localhost,root,,;
|
||||
connect con2,localhost,root,,;
|
||||
connection default;
|
||||
# Case 1: Sync blocks DML(insert) on the same table.
|
||||
CREATE TABLE t1 (
|
||||
FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
FULLTEXT(title)
|
||||
) ENGINE = InnoDB;
|
||||
SET GLOBAL debug="+d,fts_instrument_sync_debug,fts_instrument_sync_sleep";
|
||||
connection con1;
|
||||
SET GLOBAL debug_dbug='+d,fts_instrument_sync_debug,fts_instrument_sync_sleep';
|
||||
SET DEBUG_SYNC= 'fts_sync_begin SIGNAL begin WAIT_FOR continue';
|
||||
INSERT INTO t1(title) VALUES('mysql database');
|
||||
connection con2;
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR begin';
|
||||
SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database');
|
||||
connection default;
|
||||
SET DEBUG_SYNC= 'now SIGNAL continue';
|
||||
connection con1;
|
||||
/* connection con1 */ INSERT INTO t1(title) VALUES('mysql database');
|
||||
connection con2;
|
||||
/* conneciton con2 */ SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database');
|
||||
FTS_DOC_ID title
|
||||
connection default;
|
||||
# make con1 & con2 show up in mysql.slow_log
|
||||
SELECT SLEEP(2);
|
||||
SLEEP(2)
|
||||
|
|
@ -31,7 +39,7 @@ SLEEP(2)
|
|||
SELECT sql_text FROM mysql.slow_log WHERE query_time >= '00:00:02';
|
||||
sql_text
|
||||
INSERT INTO t1(title) VALUES('mysql database')
|
||||
SET GLOBAL debug="-d,fts_instrument_sync_debug,fts_instrument_sync_sleep";
|
||||
SET GLOBAL debug_dbug = @old_debug_dbug;
|
||||
TRUNCATE TABLE mysql.slow_log;
|
||||
DROP TABLE t1;
|
||||
# Case 2: Sync blocks DML(insert) on other tables.
|
||||
|
|
@ -41,14 +49,21 @@ title VARCHAR(200),
|
|||
FULLTEXT(title)
|
||||
) ENGINE = InnoDB;
|
||||
CREATE TABLE t2(id INT);
|
||||
SET GLOBAL debug="+d,fts_instrument_sync_request,fts_instrument_sync_sleep";
|
||||
connection con1;
|
||||
SET GLOBAL debug_dbug='+d,fts_instrument_sync_request,fts_instrument_sync_sleep';
|
||||
SET DEBUG_SYNC= 'fts_instrument_sync_request SIGNAL begin WAIT_FOR continue';
|
||||
INSERT INTO t1(title) VALUES('mysql database');
|
||||
connection con2;
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR begin';
|
||||
INSERT INTO t2 VALUES(1);
|
||||
connection default;
|
||||
SET DEBUG_SYNC= 'now SIGNAL continue';
|
||||
connection con1;
|
||||
/* connection con1 */ INSERT INTO t1(title) VALUES('mysql database');
|
||||
connection con2;
|
||||
/* conneciton con2 */ INSERT INTO t2 VALUES(1);
|
||||
connection default;
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
# make con1 & con2 show up in mysql.slow_log
|
||||
SELECT SLEEP(2);
|
||||
SLEEP(2)
|
||||
|
|
@ -56,12 +71,13 @@ SLEEP(2)
|
|||
# slow log results should be empty here.
|
||||
SELECT sql_text FROM mysql.slow_log WHERE query_time >= '00:00:02';
|
||||
sql_text
|
||||
SET GLOBAL debug="-d,fts_instrument_sync_request,fts_instrument_sync_sleep";
|
||||
SET GLOBAL debug_dbug = @old_debug_dbug;
|
||||
TRUNCATE TABLE mysql.slow_log;
|
||||
DROP TABLE t1,t2;
|
||||
disconnect con1;
|
||||
disconnect con2;
|
||||
# Restore slow log settings.
|
||||
SET GLOBAL log_output = @old_log_output;
|
||||
SET GLOBAL general_log = @old_general_log;
|
||||
SET GLOBAL slow_query_log = @old_slow_query_log;
|
||||
SET GLOBAL long_query_time = @old_long_query_time;
|
||||
SET GLOBAL binlog_order_commits = @old_binlog_order_commits;
|
||||
|
|
|
|||
2
mysql-test/suite/innodb_fts/t/sync.opt
Normal file
2
mysql-test/suite/innodb_fts/t/sync.opt
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
--innodb-ft-index-cache
|
||||
--innodb-ft-index-table
|
||||
|
|
@ -7,8 +7,6 @@
|
|||
--source include/not_valgrind.inc
|
||||
--source include/not_embedded.inc
|
||||
--source include/not_crashrep.inc
|
||||
--source include/not_log_bin.inc
|
||||
--source include/count_sessions.inc
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
connection default;
|
||||
|
|
@ -25,7 +23,8 @@ INSERT INTO t1(title) VALUES('database');
|
|||
|
||||
connection con1;
|
||||
|
||||
SET SESSION debug="+d,fts_instrument_sync_debug";
|
||||
SET @old_dbug = @@SESSION.debug_dbug;
|
||||
SET debug_dbug = '+d,fts_instrument_sync_debug';
|
||||
|
||||
SET DEBUG_SYNC= 'fts_write_node SIGNAL written WAIT_FOR selected';
|
||||
|
||||
|
|
@ -45,10 +44,9 @@ SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database');
|
|||
SET DEBUG_SYNC= 'now SIGNAL selected';
|
||||
|
||||
connection con1;
|
||||
--echo /* connection con1 */ INSERT INTO t1(title) VALUES('mysql database');
|
||||
--reap
|
||||
|
||||
SET SESSION debug="-d,fts_instrument_sync_debug";
|
||||
SET @old_dbug = @@SESSION.debug_dbug;
|
||||
|
||||
SET GLOBAL innodb_ft_aux_table="test/t1";
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
|
||||
|
|
@ -73,7 +71,7 @@ INSERT INTO t1(title) VALUES('database');
|
|||
|
||||
connection con1;
|
||||
|
||||
SET SESSION debug="+d,fts_instrument_sync_debug";
|
||||
SET debug_dbug = '+d,fts_instrument_sync_debug';
|
||||
|
||||
SET DEBUG_SYNC= 'fts_write_node SIGNAL written WAIT_FOR inserted';
|
||||
|
||||
|
|
@ -88,10 +86,9 @@ INSERT INTO t1(title) VALUES('mysql database');
|
|||
SET DEBUG_SYNC= 'now SIGNAL inserted';
|
||||
|
||||
connection con1;
|
||||
--echo /* connection con1 */ INSERT INTO t1(title) VALUES('mysql database');
|
||||
--reap
|
||||
|
||||
SET SESSION debug="-d,fts_instrument_sync_debug";
|
||||
SET debug_dbug = @old_dbug;
|
||||
|
||||
SET GLOBAL innodb_ft_aux_table="test/t1";
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
|
||||
|
|
@ -118,7 +115,7 @@ INSERT INTO t1(title) VALUES('database');
|
|||
|
||||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
|
||||
SET SESSION debug="+d,fts_instrument_sync_debug,fts_write_node_crash";
|
||||
SET debug_dbug = '+d,fts_instrument_sync_debug,fts_write_node_crash';
|
||||
|
||||
--error 2013
|
||||
INSERT INTO t1(title) VALUES('mysql');
|
||||
|
|
@ -128,11 +125,13 @@ INSERT INTO t1(title) VALUES('mysql');
|
|||
-- echo After restart
|
||||
SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
|
||||
|
||||
SET SESSION debug="+d,fts_instrument_sync_debug";
|
||||
SET @old_dbug = @@SESSION.debug_dbug;
|
||||
|
||||
SET debug_dbug = '+d,fts_instrument_sync_debug';
|
||||
|
||||
INSERT INTO t1(title) VALUES('mysql');
|
||||
|
||||
SET SESSION debug="-d,fts_instrument_sync_debug";
|
||||
SET debug_dbug = @old_dbug;
|
||||
|
||||
SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
|
||||
|
||||
|
|
@ -145,19 +144,21 @@ CREATE TABLE t1(
|
|||
FULLTEXT(title),
|
||||
PRIMARY KEY(id)) ENGINE=InnoDB;
|
||||
|
||||
SET SESSION debug="+d,fts_instrument_sync";
|
||||
SET debug_dbug = '+d,fts_instrument_sync';
|
||||
INSERT INTO t1(title) VALUES('mysql');
|
||||
SET SESSION debug="-d,fts_instrument_sync";
|
||||
SET debug_dbug = @old_dbug;
|
||||
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
SET GLOBAL debug="+d,fts_instrument_sync,fts_instrument_sync_interrupted";
|
||||
SET @old_global_dbug = @@GLOBAL.debug_dbug;
|
||||
SET @old_dbug = @@SESSION.debug_dbug;
|
||||
SET GLOBAL debug_dbug='+d,fts_instrument_sync,fts_instrument_sync_interrupted';
|
||||
INSERT INTO t1(title) VALUES('database');
|
||||
SET GLOBAL debug="-d,fts_instrument_sync,fts_instrument_sync_interrupted";
|
||||
SET GLOBAL debug_dbug = @old_global_dbug;
|
||||
|
||||
SET SESSION debug="+d,fts_instrument_sync_debug";
|
||||
SET debug_dbug = '+d,fts_instrument_sync_debug';
|
||||
INSERT INTO t1(title) VALUES('good');
|
||||
SET SESSION debug="-d,fts_instrument_sync_debug";
|
||||
SET debug_dbug = @old_dbug;
|
||||
|
||||
SET GLOBAL innodb_ft_aux_table="test/t1";
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
|
||||
|
|
@ -167,5 +168,3 @@ SET GLOBAL innodb_ft_aux_table=default;
|
|||
SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database good');
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--source include/wait_until_count_sessions.inc
|
||||
|
|
|
|||
|
|
@ -12,13 +12,12 @@ SET @old_log_output = @@global.log_output;
|
|||
SET @old_slow_query_log = @@global.slow_query_log;
|
||||
SET @old_general_log = @@global.general_log;
|
||||
SET @old_long_query_time = @@global.long_query_time;
|
||||
SET @old_binlog_order_commits = @@global.binlog_order_commits;
|
||||
SET @old_debug = @@global.debug_dbug;
|
||||
|
||||
SET GLOBAL log_output = 'TABLE';
|
||||
SET GLOBAL general_log = 1;
|
||||
SET GLOBAL slow_query_log = 1;
|
||||
SET GLOBAL long_query_time = 1;
|
||||
SET GLOBAL binlog_order_commits = 1;
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
connect (con2,localhost,root,,);
|
||||
|
|
@ -33,7 +32,7 @@ CREATE TABLE t1 (
|
|||
|
||||
connection con1;
|
||||
|
||||
SET GLOBAL debug="+d,fts_instrument_sync_debug,fts_instrument_sync_sleep";
|
||||
SET GLOBAL debug_dbug='+d,fts_instrument_sync_debug,fts_instrument_sync_sleep';
|
||||
|
||||
SET DEBUG_SYNC= 'fts_sync_begin SIGNAL begin WAIT_FOR continue';
|
||||
|
||||
|
|
@ -62,7 +61,7 @@ SELECT SLEEP(2);
|
|||
-- echo # slow log results should only contain INSERT INTO t1.
|
||||
SELECT sql_text FROM mysql.slow_log WHERE query_time >= '00:00:02';
|
||||
|
||||
SET GLOBAL debug="-d,fts_instrument_sync_debug,fts_instrument_sync_sleep";
|
||||
SET GLOBAL debug_dbug = @old_debug_dbug;
|
||||
TRUNCATE TABLE mysql.slow_log;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
|
@ -78,7 +77,7 @@ CREATE TABLE t2(id INT);
|
|||
|
||||
connection con1;
|
||||
|
||||
SET GLOBAL debug="+d,fts_instrument_sync_request,fts_instrument_sync_sleep";
|
||||
SET GLOBAL debug_dbug='+d,fts_instrument_sync_request,fts_instrument_sync_sleep';
|
||||
|
||||
SET DEBUG_SYNC= 'fts_instrument_sync_request SIGNAL begin WAIT_FOR continue';
|
||||
|
||||
|
|
@ -102,12 +101,13 @@ connection con2;
|
|||
--reap
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
-- echo # make con1 & con2 show up in mysql.slow_log
|
||||
SELECT SLEEP(2);
|
||||
-- echo # slow log results should be empty here.
|
||||
SELECT sql_text FROM mysql.slow_log WHERE query_time >= '00:00:02';
|
||||
|
||||
SET GLOBAL debug="-d,fts_instrument_sync_request,fts_instrument_sync_sleep";
|
||||
SET GLOBAL debug_dbug = @old_debug_dbug;
|
||||
TRUNCATE TABLE mysql.slow_log;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
|
@ -122,4 +122,3 @@ SET GLOBAL log_output = @old_log_output;
|
|||
SET GLOBAL general_log = @old_general_log;
|
||||
SET GLOBAL slow_query_log = @old_slow_query_log;
|
||||
SET GLOBAL long_query_time = @old_long_query_time;
|
||||
SET GLOBAL binlog_order_commits = @old_binlog_order_commits;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue