File: rpl_rotate_purge_deadlock.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (104 lines) | stat: -rw-r--r-- 3,386 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#Want to skip this test from daily Valgrind execution
--source include/no_valgrind_without_big.inc
#
# Bug#11763573 - 56299: MUTEX DEADLOCK WITH COM_BINLOG_DUMP, BINLOG PURGE, AND PROCESSLIST/KILL
#
--source include/not_group_replication_plugin.inc
source include/have_debug_sync.inc;
source include/have_binlog_format_row.inc;
source include/master-slave.inc;

#
# Testing that execution of two concurrent INSERTing connections both
# triggering the binlog rotation is correct even though their execution
# is interleaved.
# The test makes the first connection to complete the rotation part
# and yields control to the second connection that rotates as well and 
# gets first on purging. And the fact of interleaving does not create
# any issue.
# 

# this test case requires a deterministic binary log size
# so that automatic purging is exercized. Therefore, cannot
# run with compression on.
--source include/not_binlog_transaction_compression_on.inc


connection master;
source include/show_binary_logs.inc;
create table t1 (f text) engine=innodb;
SET DEBUG_SYNC = 'at_purge_logs_before_date WAIT_FOR rotated';
send insert into t1 set f=repeat('a', 4096);

connection master1;

let $wait_condition=
  SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
    WHERE STATE like "debug sync point: at_purge_logs_before_date%";
--source include/wait_condition_or_abort.inc

--echo *** there must be two logs in the list ***
source include/show_binary_logs.inc;

insert into t1 set f=repeat('b', 4096);

--echo *** there must be three logs in the list ***
source include/show_binary_logs.inc;

SET DEBUG_SYNC = 'now SIGNAL rotated';
--let $wait_condition= SELECT COUNT(*)=0 FROM information_schema.processlist WHERE state LIKE 'debug sync point: at_purge_logs_before_date%'
--source include/wait_condition.inc
SET DEBUG_SYNC = 'RESET';

# the first connection finally completes its INSERT
connection master;
reap;
SET DEBUG_SYNC = 'RESET';

--source include/sync_slave_sql_with_master.inc


#
# Testing the reported deadlock involving DUMP, KILL and INSERT threads
#

connection master;
SET DEBUG_SYNC = 'at_purge_logs_before_date WAIT_FOR rotated';
send insert into t1 set f=repeat('b', 4096);

connection master1;

# make sure INSERT reaches waiting point
let $wait_condition=
  SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
    WHERE STATE like "debug sync point: at_purge_logs_before_date%";
--source include/wait_condition_or_abort.inc

# find and kill DUMP thread
let $_tid= `select id from information_schema.processlist where command like 'Binlog Dump%' limit 1`;
--disable_query_log
eval kill query $_tid;
--enable_query_log

#
# Now the proof is that the new DUMP thread has executed
# a critical section of the deadlock without any regression and is UP
#
let $wait_condition=
  SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
    WHERE command like 'Binlog Dump%' and STATE like "Source has sent all binlog to replica%";
--source include/wait_condition_or_abort.inc

SET DEBUG_SYNC = 'now SIGNAL rotated';
--let $wait_condition= SELECT COUNT(*)=0 FROM information_schema.processlist WHERE state LIKE 'debug sync point: at_purge_logs_before_date%'
--source include/wait_condition.inc
SET DEBUG_SYNC = 'RESET';

connection master;
reap;
SET DEBUG_SYNC = 'RESET';
drop table t1;

--source include/sync_slave_sql_with_master.inc

--source include/rpl_end.inc