| 1 |
# |
| 2 |
# BUG#22516559 MYSQL INSTANCE STALLS WHEN SYNCING FTS INDEX |
| 3 |
# |
| 4 |
|
| 5 |
# The test makes assumptions about query execution |
| 6 |
# time which make valgrind testing unstable |
| 7 |
--source include/not_valgrind.inc |
| 8 |
--source include/have_debug.inc |
| 9 |
--source include/have_debug_sync.inc |
| 10 |
--source include/have_log_bin.inc |
| 11 |
--source include/count_sessions.inc |
| 12 |
|
| 13 |
SET @old_log_output = @@global.log_output; |
| 14 |
SET @old_slow_query_log = @@global.slow_query_log; |
| 15 |
SET @old_general_log = @@global.general_log; |
| 16 |
SET @old_long_query_time = @@global.long_query_time; |
| 17 |
SET @old_binlog_order_commits = @@global.binlog_order_commits; |
| 18 |
|
| 19 |
SET GLOBAL log_output = 'TABLE'; |
| 20 |
SET GLOBAL general_log = 1; |
| 21 |
SET GLOBAL slow_query_log = 1; |
| 22 |
SET GLOBAL long_query_time = 1; |
| 23 |
SET GLOBAL binlog_order_commits = 1; |
| 24 |
|
| 25 |
connect (con1,localhost,root,,); |
| 26 |
connect (con2,localhost,root,,); |
| 27 |
connection default; |
| 28 |
|
| 29 |
--echo # Case 1: Sync blocks DML(insert) on the same table. |
| 30 |
CREATE TABLE t1 ( |
| 31 |
FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, |
| 32 |
title VARCHAR(200), |
| 33 |
FULLTEXT(title) |
| 34 |
) ENGINE = InnoDB; |
| 35 |
|
| 36 |
connection con1; |
| 37 |
|
| 38 |
SET GLOBAL debug="+d,fts_instrument_sync_debug,fts_instrument_sync_sleep"; |
| 39 |
|
| 40 |
SET DEBUG_SYNC= 'fts_sync_begin SIGNAL begin WAIT_FOR continue'; |
| 41 |
|
| 42 |
send INSERT INTO t1(title) VALUES('mysql database'); |
| 43 |
|
| 44 |
connection con2; |
| 45 |
|
| 46 |
SET DEBUG_SYNC= 'now WAIT_FOR begin'; |
| 47 |
|
| 48 |
send SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database'); |
| 49 |
|
| 50 |
connection default; |
| 51 |
SET DEBUG_SYNC= 'now SIGNAL continue'; |
| 52 |
|
| 53 |
connection con1; |
| 54 |
--echo /* connection con1 */ INSERT INTO t1(title) VALUES('mysql database'); |
| 55 |
--reap |
| 56 |
|
| 57 |
connection con2; |
| 58 |
--echo /* conneciton con2 */ SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database'); |
| 59 |
--reap |
| 60 |
|
| 61 |
connection default; |
| 62 |
-- echo # make con1 & con2 show up in mysql.slow_log |
| 63 |
SELECT SLEEP(2); |
| 64 |
-- echo # slow log results should only contain INSERT INTO t1. |
| 65 |
SELECT sql_text FROM mysql.slow_log WHERE query_time >= '00:00:02' AND sql_text LIKE 'INSERT%'; |
| 66 |
|
| 67 |
SET GLOBAL debug="-d,fts_instrument_sync_debug,fts_instrument_sync_sleep"; |
| 68 |
TRUNCATE TABLE mysql.slow_log; |
| 69 |
|
| 70 |
DROP TABLE t1; |
| 71 |
|
| 72 |
--echo # Case 2: Sync blocks DML(insert) on other tables. |
| 73 |
CREATE TABLE t1 ( |
| 74 |
FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, |
| 75 |
title VARCHAR(200), |
| 76 |
FULLTEXT(title) |
| 77 |
) ENGINE = InnoDB; |
| 78 |
|
| 79 |
CREATE TABLE t2(id INT); |
| 80 |
|
| 81 |
connection con1; |
| 82 |
|
| 83 |
SET GLOBAL debug="+d,fts_instrument_sync_request,fts_instrument_sync_sleep"; |
| 84 |
|
| 85 |
SET DEBUG_SYNC= 'fts_instrument_sync_request SIGNAL begin WAIT_FOR continue'; |
| 86 |
|
| 87 |
send INSERT INTO t1(title) VALUES('mysql database'); |
| 88 |
|
| 89 |
connection con2; |
| 90 |
|
| 91 |
SET DEBUG_SYNC= 'now WAIT_FOR begin'; |
| 92 |
|
| 93 |
send INSERT INTO t2 VALUES(1); |
| 94 |
|
| 95 |
connection default; |
| 96 |
SET DEBUG_SYNC= 'now SIGNAL continue'; |
| 97 |
|
| 98 |
connection con1; |
| 99 |
--echo /* connection con1 */ INSERT INTO t1(title) VALUES('mysql database'); |
| 100 |
--reap |
| 101 |
|
| 102 |
connection con2; |
| 103 |
--echo /* conneciton con2 */ INSERT INTO t2 VALUES(1); |
| 104 |
--reap |
| 105 |
|
| 106 |
connection default; |
| 107 |
-- echo # make con1 & con2 show up in mysql.slow_log |
| 108 |
SELECT SLEEP(2); |
| 109 |
-- echo # slow log results should be empty here. |
| 110 |
SELECT sql_text FROM mysql.slow_log WHERE query_time >= '00:00:02'; |
| 111 |
|
| 112 |
SET GLOBAL debug="-d,fts_instrument_sync_request,fts_instrument_sync_sleep"; |
| 113 |
TRUNCATE TABLE mysql.slow_log; |
| 114 |
|
| 115 |
DROP TABLE t1,t2; |
| 116 |
|
| 117 |
disconnect con1; |
| 118 |
disconnect con2; |
| 119 |
|
| 120 |
--source include/wait_until_count_sessions.inc |
| 121 |
|
| 122 |
-- echo # Restore slow log settings. |
| 123 |
SET GLOBAL log_output = @old_log_output; |
| 124 |
SET GLOBAL general_log = @old_general_log; |
| 125 |
SET GLOBAL slow_query_log = @old_slow_query_log; |
| 126 |
SET GLOBAL long_query_time = @old_long_query_time; |
| 127 |
SET GLOBAL binlog_order_commits = @old_binlog_order_commits; |
| 128 |
TRUNCATE TABLE mysql.general_log; |
| 129 |
TRUNCATE TABLE mysql.slow_log; |