| 1 |
SET @old_log_output = @@global.log_output; |
| 2 |
SET @old_slow_query_log = @@global.slow_query_log; |
| 3 |
SET @old_general_log = @@global.general_log; |
| 4 |
SET @old_long_query_time = @@global.long_query_time; |
| 5 |
SET @old_binlog_order_commits = @@global.binlog_order_commits; |
| 6 |
SET GLOBAL log_output = 'TABLE'; |
| 7 |
SET GLOBAL general_log = 1; |
| 8 |
SET GLOBAL slow_query_log = 1; |
| 9 |
SET GLOBAL long_query_time = 1; |
| 10 |
SET GLOBAL binlog_order_commits = 1; |
| 11 |
# Case 1: Sync blocks DML(insert) on the same table. |
| 12 |
CREATE TABLE t1 ( |
| 13 |
FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, |
| 14 |
title VARCHAR(200), |
| 15 |
FULLTEXT(title) |
| 16 |
) ENGINE = InnoDB; |
| 17 |
SET GLOBAL debug="+d,fts_instrument_sync_debug,fts_instrument_sync_sleep"; |
| 18 |
SET DEBUG_SYNC= 'fts_sync_begin SIGNAL begin WAIT_FOR continue'; |
| 19 |
INSERT INTO t1(title) VALUES('mysql database'); |
| 20 |
SET DEBUG_SYNC= 'now WAIT_FOR begin'; |
| 21 |
SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database'); |
| 22 |
SET DEBUG_SYNC= 'now SIGNAL continue'; |
| 23 |
/* connection con1 */ INSERT INTO t1(title) VALUES('mysql database'); |
| 24 |
/* conneciton con2 */ SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database'); |
| 25 |
FTS_DOC_ID title |
| 26 |
# make con1 & con2 show up in mysql.slow_log |
| 27 |
SELECT SLEEP(2); |
| 28 |
SLEEP(2) |
| 29 |
0 |
| 30 |
# slow log results should only contain INSERT INTO t1. |
| 31 |
SELECT sql_text FROM mysql.slow_log WHERE query_time >= '00:00:02' AND sql_text LIKE 'INSERT%'; |
| 32 |
sql_text |
| 33 |
INSERT INTO t1(title) VALUES('mysql database') |
| 34 |
SET GLOBAL debug="-d,fts_instrument_sync_debug,fts_instrument_sync_sleep"; |
| 35 |
TRUNCATE TABLE mysql.slow_log; |
| 36 |
DROP TABLE t1; |
| 37 |
# Case 2: Sync blocks DML(insert) on other tables. |
| 38 |
CREATE TABLE t1 ( |
| 39 |
FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, |
| 40 |
title VARCHAR(200), |
| 41 |
FULLTEXT(title) |
| 42 |
) ENGINE = InnoDB; |
| 43 |
CREATE TABLE t2(id INT); |
| 44 |
SET GLOBAL debug="+d,fts_instrument_sync_request,fts_instrument_sync_sleep"; |
| 45 |
SET DEBUG_SYNC= 'fts_instrument_sync_request SIGNAL begin WAIT_FOR continue'; |
| 46 |
INSERT INTO t1(title) VALUES('mysql database'); |
| 47 |
SET DEBUG_SYNC= 'now WAIT_FOR begin'; |
| 48 |
INSERT INTO t2 VALUES(1); |
| 49 |
SET DEBUG_SYNC= 'now SIGNAL continue'; |
| 50 |
/* connection con1 */ INSERT INTO t1(title) VALUES('mysql database'); |
| 51 |
/* conneciton con2 */ INSERT INTO t2 VALUES(1); |
| 52 |
# make con1 & con2 show up in mysql.slow_log |
| 53 |
SELECT SLEEP(2); |
| 54 |
SLEEP(2) |
| 55 |
0 |
| 56 |
# slow log results should be empty here. |
| 57 |
SELECT sql_text FROM mysql.slow_log WHERE query_time >= '00:00:02'; |
| 58 |
sql_text |
| 59 |
SET GLOBAL debug="-d,fts_instrument_sync_request,fts_instrument_sync_sleep"; |
| 60 |
TRUNCATE TABLE mysql.slow_log; |
| 61 |
DROP TABLE t1,t2; |
| 62 |
# Restore slow log settings. |
| 63 |
SET GLOBAL log_output = @old_log_output; |
| 64 |
SET GLOBAL general_log = @old_general_log; |
| 65 |
SET GLOBAL slow_query_log = @old_slow_query_log; |
| 66 |
SET GLOBAL long_query_time = @old_long_query_time; |
| 67 |
SET GLOBAL binlog_order_commits = @old_binlog_order_commits; |
| 68 |
TRUNCATE TABLE mysql.general_log; |
| 69 |
TRUNCATE TABLE mysql.slow_log; |