Debian Codegraph @

mysql-test/suite/rpl/t/rpl_rotate_purge_deadlock.test

raw
1 #
2 # Bug#11763573 - 56299: MUTEX DEADLOCK WITH COM_BINLOG_DUMP, BINLOG PURGE, AND PROCESSLIST/KILL
3 #
4 source include/have_debug_sync.inc;
5 source include/have_binlog_format_row.inc;
6 source include/have_innodb.inc;
7 source include/master-slave.inc;
8
9 #
10 # Testing that execution of two concurrent INSERTing connections both
11 # triggering the binlog rotation is correct even though their execution
12 # is interleaved.
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
16 # any issue.
17 #
18
19 connection master;
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 SET DEBUG_SYNC = 'after_purge_logs_before_date SIGNAL continued';
24 send insert into t1 set f=repeat('a', 4096);
25
26 connection master1;
27
28 let $wait_condition=
29 SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
30 WHERE STATE like "debug sync point: at_purge_logs_before_date%";
31 --source include/wait_condition.inc
32
33 --echo *** there must be two logs in the list ***
34 source include/show_binary_logs.inc;
35
36 insert into t1 set f=repeat('b', 4096);
37
38 --echo *** there must be three logs in the list ***
39 source include/show_binary_logs.inc;
40
41 SET DEBUG_SYNC = 'now SIGNAL rotated';
42 SET DEBUG_SYNC = 'now WAIT_FOR continued';
43 SET DEBUG_SYNC = 'RESET';
44
45 # the first connection finally completes its INSERT
46 connection master;
47 reap;
48 SET DEBUG_SYNC = 'RESET';
49
50 sync_slave_with_master;
51
52
53 #
54 # Testing the reported deadlock involving DUMP, KILL and INSERT threads
55 #
56
57 connection master;
58 SET DEBUG_SYNC = 'at_purge_logs_before_date WAIT_FOR rotated';
59 SET DEBUG_SYNC = 'after_purge_logs_before_date SIGNAL continued';
60 send insert into t1 set f=repeat('b', 4096);
61
62 connection master1;
63
64 # make sure INSERT reaches waiting point
65 let $wait_condition=
66 SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
67 WHERE STATE like "debug sync point: at_purge_logs_before_date%";
68 --source include/wait_condition.inc
69
70 # find and kill DUMP thread
71 let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`;
72 --disable_query_log
73 eval kill query $_tid;
74 --enable_query_log
75
76 #
77 # Now the proof is that the new DUMP thread has executed
78 # a critical section of the deadlock without any regression and is UP
79 #
80 let $wait_condition=
81 SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
82 WHERE command = 'Binlog Dump' and STATE like "Master has sent all binlog to slave%";
83 --source include/wait_condition.inc
84
85 SET DEBUG_SYNC = 'now SIGNAL rotated';
86 SET DEBUG_SYNC = 'now WAIT_FOR continued';
87 SET DEBUG_SYNC = 'RESET';
88
89 connection master;
90 reap;
91 SET DEBUG_SYNC = 'RESET';
92 drop table t1;
93
94 sync_slave_with_master;
95
96 --source include/rpl_end.inc