Debian Codegraph @

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

raw
1 #Want to skip this test from daily Valgrind execution
2 --source include/no_valgrind_without_big.inc
3 #
4 # Bug#11763573 - 56299: MUTEX DEADLOCK WITH COM_BINLOG_DUMP, BINLOG PURGE, AND PROCESSLIST/KILL
5 #
6 --source include/not_group_replication_plugin.inc
7 source include/have_debug_sync.inc;
8 source include/have_binlog_format_row.inc;
9 source include/master-slave.inc;
10
11 #
12 # Testing that execution of two concurrent INSERTing connections both
13 # triggering the binlog rotation is correct even though their execution
14 # is interleaved.
15 # The test makes the first connection to complete the rotation part
16 # and yields control to the second connection that rotates as well and
17 # gets first on purging. And the fact of interleaving does not create
18 # any issue.
19 #
20
21 # this test case requires a deterministic binary log size
22 # so that automatic purging is exercized. Therefore, cannot
23 # run with compression on.
24 --source include/not_binlog_transaction_compression_on.inc
25
26
27 connection master;
28 source include/show_binary_logs.inc;
29 create table t1 (f text) engine=innodb;
30 SET DEBUG_SYNC = 'at_purge_logs_before_date WAIT_FOR rotated';
31 send insert into t1 set f=repeat('a', 4096);
32
33 connection master1;
34
35 let $wait_condition=
36 SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
37 WHERE STATE like "debug sync point: at_purge_logs_before_date%";
38 --source include/wait_condition_or_abort.inc
39
40 --echo *** there must be two logs in the list ***
41 source include/show_binary_logs.inc;
42
43 insert into t1 set f=repeat('b', 4096);
44
45 --echo *** there must be three logs in the list ***
46 source include/show_binary_logs.inc;
47
48 SET DEBUG_SYNC = 'now SIGNAL rotated';
49 --let $wait_condition= SELECT COUNT(*)=0 FROM information_schema.processlist WHERE state LIKE 'debug sync point: at_purge_logs_before_date%'
50 --source include/wait_condition.inc
51 SET DEBUG_SYNC = 'RESET';
52
53 # the first connection finally completes its INSERT
54 connection master;
55 reap;
56 SET DEBUG_SYNC = 'RESET';
57
58 --source include/sync_slave_sql_with_master.inc
59
60
61 #
62 # Testing the reported deadlock involving DUMP, KILL and INSERT threads
63 #
64
65 connection master;
66 SET DEBUG_SYNC = 'at_purge_logs_before_date WAIT_FOR rotated';
67 send insert into t1 set f=repeat('b', 4096);
68
69 connection master1;
70
71 # make sure INSERT reaches waiting point
72 let $wait_condition=
73 SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
74 WHERE STATE like "debug sync point: at_purge_logs_before_date%";
75 --source include/wait_condition_or_abort.inc
76
77 # find and kill DUMP thread
78 let $_tid= `select id from information_schema.processlist where command like 'Binlog Dump%' limit 1`;
79 --disable_query_log
80 eval kill query $_tid;
81 --enable_query_log
82
83 #
84 # Now the proof is that the new DUMP thread has executed
85 # a critical section of the deadlock without any regression and is UP
86 #
87 let $wait_condition=
88 SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
89 WHERE command like 'Binlog Dump%' and STATE like "Source has sent all binlog to replica%";
90 --source include/wait_condition_or_abort.inc
91
92 SET DEBUG_SYNC = 'now SIGNAL rotated';
93 --let $wait_condition= SELECT COUNT(*)=0 FROM information_schema.processlist WHERE state LIKE 'debug sync point: at_purge_logs_before_date%'
94 --source include/wait_condition.inc
95 SET DEBUG_SYNC = 'RESET';
96
97 connection master;
98 reap;
99 SET DEBUG_SYNC = 'RESET';
100 drop table t1;
101
102 --source include/sync_slave_sql_with_master.inc
103
104 --source include/rpl_end.inc