| 1 |
############################################################################### |
| 2 |
# Bug#19843808: DEADLOCK ON FLUSH TABLES WITH READ LOCK + SHOW |
| 3 |
# SLAVE STATUS |
| 4 |
# |
| 5 |
# Problem: |
| 6 |
# ======== |
| 7 |
# If a client thread on an slave does FLUSH TABLES WITH READ |
| 8 |
# LOCK; then master does some updates, SHOW SLAVE STATUS in |
| 9 |
# the same client will be blocked. |
| 10 |
# |
| 11 |
# Test: |
| 12 |
# ===== |
| 13 |
# Execute a DML on master and make it blocked on slave after entering commit. |
| 14 |
# Execute FLUSH TABLES WITH READ LOCK on slave. Allow the blocked DML to |
| 15 |
# continue. The sql thread will be blocked in a state where it has acquired |
| 16 |
# rli->data_lock and it is waiting for MDL COMMIT lock. Now execute show slave |
| 17 |
# status command from the same client where FLUSH TABLES WITH READ LOCK was |
| 18 |
# issued. The show slave status command should not be blocked. |
| 19 |
############################################################################### |
| 20 |
--source include/have_binlog_format_mixed.inc |
| 21 |
--source include/master-slave.inc |
| 22 |
--source include/have_debug.inc |
| 23 |
--source include/have_debug_sync.inc |
| 24 |
|
| 25 |
--echo # Let master and slave synced with t1 table created |
| 26 |
CREATE TABLE t1 (f INT) ENGINE= INNODB; |
| 27 |
--source include/sync_slave_sql_with_master.inc |
| 28 |
|
| 29 |
--echo # Setup GLOBAL.DEBUG at slave to reach commit |
| 30 |
--source include/rpl_connection_slave.inc |
| 31 |
|
| 32 |
--let $debug_point= dbug.reached_commit |
| 33 |
--source include/add_debug_point.inc |
| 34 |
|
| 35 |
--echo # Do some DML operation on master so that it will be blocked on |
| 36 |
--echo # slave as global read lock is in place. |
| 37 |
--source include/rpl_connection_master.inc |
| 38 |
INSERT INTO t1 VALUES (10); |
| 39 |
|
| 40 |
--echo # Issue FLUSH TABLES WITH READ LOCK after Reached is signaled |
| 41 |
--source include/rpl_connection_slave.inc |
| 42 |
SET DEBUG_SYNC='now WAIT_FOR Reached'; |
| 43 |
FLUSH TABLES WITH READ LOCK; |
| 44 |
--echo # Let sql thread continue to try to obtain commit lock |
| 45 |
SET DEBUG_SYNC= 'now SIGNAL signal.commit_continue'; |
| 46 |
|
| 47 |
--echo # Wait until sql thread enters "Waiting for commit lock" state |
| 48 |
let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist |
| 49 |
WHERE state = "Waiting for commit lock"; |
| 50 |
--source include/wait_condition.inc |
| 51 |
|
| 52 |
--source include/rpl_connection_slave.inc |
| 53 |
--disable_result_log |
| 54 |
query_vertical SHOW SLAVE STATUS; |
| 55 |
--enable_result_log |
| 56 |
UNLOCK TABLES; |
| 57 |
|
| 58 |
--let $debug_point= dbug.reached_commit |
| 59 |
--source include/remove_debug_point.inc |
| 60 |
|
| 61 |
--echo # Restart SQL thread so that it notices debug has changed |
| 62 |
--source include/restart_slave_sql.inc |
| 63 |
|
| 64 |
--source include/rpl_connection_master.inc |
| 65 |
--source include/sync_slave_sql_with_master.inc |
| 66 |
|
| 67 |
let $diff_tables= master:t1, slave:t1; |
| 68 |
source include/diff_tables.inc; |
| 69 |
|
| 70 |
--source include/rpl_connection_master.inc |
| 71 |
DROP TABLE t1; |
| 72 |
--source include/sync_slave_sql_with_master.inc |
| 73 |
|
| 74 |
--source include/rpl_end.inc |