2
# Bug#11763573 - 56299: MUTEX DEADLOCK WITH COM_BINLOG_DUMP, BINLOG PURGE, AND PROCESSLIST/KILL
4
source include/master-slave.inc;
5
source include/have_debug_sync.inc;
6
source include/have_binlog_format_row.inc;
7
source include/have_innodb.inc;
10
# Testing that execution of two concurrent INSERTing connections both
11
# triggering the binlog rotation is correct even though their execution
13
# The test makes the first connection to complete the rotation part
14
# and yields control to the second connection that rotates as well and
15
# gets first on purging. And the fact of interleaving does not create
20
source include/show_binary_logs.inc;
21
create table t1 (f text) engine=innodb;
22
SET DEBUG_SYNC = 'at_purge_logs_before_date WAIT_FOR rotated';
23
send insert into t1 set f=repeat('a', 4096);
28
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
29
WHERE STATE like "debug sync point: at_purge_logs_before_date%";
30
--source include/wait_condition.inc
32
--echo *** there must be two logs in the list ***
33
source include/show_binary_logs.inc;
35
insert into t1 set f=repeat('b', 4096);
37
--echo *** there must be three logs in the list ***
38
source include/show_binary_logs.inc;
40
SET DEBUG_SYNC = 'now SIGNAL rotated';
41
SET DEBUG_SYNC = 'RESET';
43
# the first connection finally completes its INSERT
46
SET DEBUG_SYNC = 'RESET';
48
sync_slave_with_master;
52
# Testing the reported deadlock involving DUMP, KILL and INSERT threads
56
SET DEBUG_SYNC = 'at_purge_logs_before_date WAIT_FOR rotated';
57
send insert into t1 set f=repeat('b', 4096);
61
# make sure INSERT reaches waiting point
63
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
64
WHERE STATE like "debug sync point: at_purge_logs_before_date%";
65
--source include/wait_condition.inc
67
# find and kill DUMP thread
68
let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`;
70
eval kill query $_tid;
74
# Now the proof is that the new DUMP thread has executed
75
# a critical section of the deadlock without any regression and is UP
78
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
79
WHERE command = 'Binlog Dump' and STATE like "Master has sent all binlog to slave%";
80
--source include/wait_condition.inc
82
SET DEBUG_SYNC = 'now SIGNAL rotated';
83
SET DEBUG_SYNC = 'RESET';
87
SET DEBUG_SYNC = 'RESET';
90
sync_slave_with_master;
92
--source include/rpl_end.inc