Debian Codegraph @

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

raw
1 # MDEV-20821 parallel slave server shutdown hang
2 #
3 # Test the bug condition of a parallel slave server shutdown
4 # hang when the parallel workers were idle.
5 # The bug reported scenario is extented to cover the multi-sources case as well as
6 # checking is done for both the idle and busy workers cases.
7 #
8 # MDEV-25336 Parallel replication causes failed assert while restarting
9 # Since this test case involves slave restart this will help in testing
10 # Mdev-25336 too.
11
12 --source include/have_innodb.inc
13 --source include/have_binlog_format_mixed.inc
14 --let $rpl_topology= 1->3
15 --source include/rpl_init.inc
16
17 #
18 # A. idle workers.
19 #
20 --connection server_3
21 set default_master_connection = '';
22 --source include/start_slave.inc
23
24 set default_master_connection = 'm2';
25 --replace_result $SERVER_MYPORT_2 SERVER_MYPORT_2
26 eval change master to master_host='127.0.0.1', master_port=$SERVER_MYPORT_2, master_user='root', master_ssl_verify_server_cert=0, master_use_gtid=slave_pos;
27 --source include/start_slave.inc
28
29 select @@global.slave_parallel_workers as two;
30
31 # At this point worker threads have no assignement.
32 # Shutdown must not hang.
33 # In 10.2/10.3 there should not be any assert failure `prev != 0 && next != 0'
34 --connection server_3
35 --write_file $MYSQLTEST_VARDIR/tmp/mysqld.3.expect
36 wait
37 EOF
38 --send SHUTDOWN
39 --reap
40 --source include/wait_until_disconnected.inc
41
42 --connection server_3
43 --append_file $MYSQLTEST_VARDIR/tmp/mysqld.3.expect
44 restart
45 EOF
46
47 # No hang is *proved* to occur when this point is reached.
48 --connection server_3
49 --enable_reconnect
50 --source include/wait_until_connected_again.inc
51
52 #
53 # B. resting workers after some busy time
54 #
55 --connection server_1
56 create table t1 (i int primary key) engine=Innodb;
57
58 --connection server_2
59 create table t2 (i int primary key) engine=Innodb;
60
61 --connection server_3
62 set default_master_connection = '';
63 --source include/start_slave.inc
64
65 set default_master_connection = 'm2';
66 --source include/start_slave.inc
67
68 --connection server_2
69 insert into t2 values (1);
70 --save_master_pos
71
72 --connection server_3
73 --sync_with_master 0,'m2'
74
75 --connection server_1
76 insert into t1 values (1);
77 --save_master_pos
78
79 --connection server_3
80 --sync_with_master 0,''
81
82 # In 10.2/10.3 there should not be any assert failure `prev != 0 && next != 0'
83 # At this point worker threads have no assignement.
84 # Shutdown must not hang.
85
86 --connection server_3
87 --write_file $MYSQLTEST_VARDIR/tmp/mysqld.3.expect
88 wait
89 EOF
90 --send SHUTDOWN
91 --reap
92 --source include/wait_until_disconnected.inc
93
94 --connection server_3
95 --append_file $MYSQLTEST_VARDIR/tmp/mysqld.3.expect
96 restart
97 EOF
98
99 # No hang is *proved* to occur when this point is reached.
100 --connection server_3
101 --enable_reconnect
102 --source include/wait_until_connected_again.inc
103
104 #
105 # C. busy workers
106 #
107 --connection server_3
108 set default_master_connection = '';
109 --source include/start_slave.inc
110
111 set default_master_connection = 'm2';
112 --source include/start_slave.inc
113
114 --connect (conn_block_server3, 127.0.0.1, root,, test, $SERVER_MYPORT_3,)
115 begin;
116 insert into t1 values (2);
117 insert into t2 values (2);
118
119 --connection server_1
120 insert into t1 values (2);
121 --connection server_2
122 insert into t2 values (2);
123
124
125 # In 10.2/10.3 there should not be any assert failure `prev != 0 && next != 0'
126 # At this point there's a good chance the worker threads are busy.
127 # SHUTDOWN must proceed without any delay as above.
128 --connection server_3
129 --write_file $MYSQLTEST_VARDIR/tmp/mysqld.3.expect
130 wait
131 EOF
132 --send SHUTDOWN
133 --reap
134 --source include/wait_until_disconnected.inc
135
136 --connection server_3
137 --append_file $MYSQLTEST_VARDIR/tmp/mysqld.3.expect
138 restart
139 EOF
140
141 # No hang is *proved* to occur when this point is reached.
142 --connection server_3
143 --enable_reconnect
144 --source include/wait_until_connected_again.inc
145
146
147 # Cleanup
148
149 --connection server_3
150 set default_master_connection = '';
151 --source include/start_slave.inc
152
153 set default_master_connection = 'm2';
154 --source include/start_slave.inc
155
156 --connection server_1
157 drop table t1;
158
159 --connection server_2
160 drop table t2;
161 --save_master_pos
162
163 # (!) The following block is critical to avoid check-mysqld_3.reject by mtr:
164 --connection server_3
165 --sync_with_master 0,'m2'
166 set default_master_connection = 'm2';
167 --source include/stop_slave.inc
168 RESET SLAVE ALL;
169 set default_master_connection = '';
170
171 --source include/rpl_end.inc