Debian Codegraph @

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

raw
1 --echo *** MDEV-8031: Parallel replication stops on "connection killed" error (probably incorrectly handled deadlock kill) ***
2
3 --source include/have_innodb.inc
4 --source include/have_debug.inc
5 --source include/have_debug_sync.inc
6 --source include/master-slave.inc
7
8 --connection server_2
9 SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
10 --source include/stop_slave.inc
11 SET GLOBAL slave_parallel_threads=10;
12 CHANGE MASTER TO master_use_gtid=slave_pos;
13 --source include/start_slave.inc
14
15 --connection server_1
16 ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
17 CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
18 INSERT INTO t3 VALUES (201,0), (202,0);
19 --source include/save_master_gtid.inc
20
21 --connection server_2
22 --source include/sync_with_master_gtid.inc
23 --source include/stop_slave.inc
24 SET @old_dbug= @@GLOBAL.debug_dbug;
25 SET GLOBAL debug_dbug= '+d,inject_mdev8031';
26
27 --connection server_1
28 # We artificially create a situation that hopefully resembles the original
29 # bug which was only seen "in the wild", and only once.
30 # Setup a fake group commit with lots of conflicts that will lead to deadloc
31 # kill. The slave DBUG injection causes the slave to be deadlock killed at
32 # a particular point during the retry, and then later do a small sleep at
33 # another critical point where the prior transaction then has a chance to
34 # complete. Finally an extra KILL check catches an unhandled, lingering
35 # deadlock kill. So rather artificial, but at least it exercises the
36 # relevant code paths.
37 SET @old_dbug= @@SESSION.debug_dbug;
38 SET SESSION debug_dbug="+d,binlog_force_commit_id";
39
40 SET @commit_id= 10200;
41 INSERT INTO t3 VALUES (203, 1);
42 INSERT INTO t3 VALUES (204, 1);
43 INSERT INTO t3 VALUES (205, 1);
44 UPDATE t3 SET b=b+1 WHERE a=201;
45 UPDATE t3 SET b=b+1 WHERE a=201;
46 UPDATE t3 SET b=b+1 WHERE a=201;
47 UPDATE t3 SET b=b+1 WHERE a=202;
48 UPDATE t3 SET b=b+1 WHERE a=202;
49 UPDATE t3 SET b=b+1 WHERE a=202;
50 UPDATE t3 SET b=b+1 WHERE a=202;
51 UPDATE t3 SET b=b+1 WHERE a=203;
52 UPDATE t3 SET b=b+1 WHERE a=203;
53 UPDATE t3 SET b=b+1 WHERE a=204;
54 UPDATE t3 SET b=b+1 WHERE a=204;
55 UPDATE t3 SET b=b+1 WHERE a=204;
56 UPDATE t3 SET b=b+1 WHERE a=203;
57 UPDATE t3 SET b=b+1 WHERE a=205;
58 UPDATE t3 SET b=b+1 WHERE a=205;
59 SET SESSION debug_dbug=@old_dbug;
60
61 SELECT * FROM t3 WHERE a>=200 ORDER BY a;
62 --source include/save_master_gtid.inc
63
64 --connection server_2
65 --source include/start_slave.inc
66 --source include/sync_with_master_gtid.inc
67
68 SELECT * FROM t3 WHERE a>=200 ORDER BY a;
69 --source include/stop_slave.inc
70 SET GLOBAL debug_dbug= @old_dbug;
71 --source include/start_slave.inc
72
73
74 --echo *** Check getting deadlock killed inside open_binlog() during retry. ***
75
76 --connection server_2
77 --source include/stop_slave.inc
78 SET @old_dbug= @@GLOBAL.debug_dbug;
79 SET GLOBAL debug_dbug= '+d,inject_retry_event_group_open_binlog_kill';
80 SET @old_max= @@GLOBAL.max_relay_log_size;
81 SET GLOBAL max_relay_log_size= 4096;
82
83 --connection server_1
84 SET @old_dbug= @@SESSION.debug_dbug;
85 SET SESSION debug_dbug="+d,binlog_force_commit_id";
86
87 --let $large= `SELECT REPEAT("*", 8192)`
88 SET @commit_id= 10210;
89 --echo Omit long queries that cause relaylog rotations and transaction retries...
90 --disable_query_log
91 eval UPDATE t3 SET b=b+1 WHERE a=201 /* $large */;
92 eval UPDATE t3 SET b=b+1 WHERE a=201 /* $large */;
93 eval UPDATE t3 SET b=b+1 WHERE a=201 /* $large */;
94 eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */;
95 eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */;
96 eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */;
97 eval UPDATE t3 SET b=b+1 WHERE a=202 /* $large */;
98 eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */;
99 eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */;
100 eval UPDATE t3 SET b=b+1 WHERE a=204 /* $large */;
101 eval UPDATE t3 SET b=b+1 WHERE a=204 /* $large */;
102 eval UPDATE t3 SET b=b+1 WHERE a=204 /* $large */;
103 eval UPDATE t3 SET b=b+1 WHERE a=203 /* $large */;
104 eval UPDATE t3 SET b=b+1 WHERE a=205 /* $large */;
105 eval UPDATE t3 SET b=b+1 WHERE a=205 /* $large */;
106 --enable_query_log
107 SET SESSION debug_dbug=@old_dbug;
108
109 SELECT * FROM t3 WHERE a>=200 ORDER BY a;
110 --source include/save_master_gtid.inc
111
112 --connection server_2
113 --source include/start_slave.inc
114 --source include/sync_with_master_gtid.inc
115
116 SELECT * FROM t3 WHERE a>=200 ORDER BY a;
117
118 # Cleanup
119 --source include/stop_slave.inc
120 SET GLOBAL debug_dbug= @old_debg;
121 SET GLOBAL max_relay_log_size= @old_max;
122 SET GLOBAL slave_parallel_threads=@old_parallel_threads;
123 --source include/start_slave.inc
124
125 --connection server_1
126 DROP TABLE t3;
127
128 --source include/rpl_end.inc
129