Debian Codegraph @

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

raw
1 # MDEV-36359: Master crashes when reverting to async after Semi-Sync disabled.
2 #
3 # Assert behavior of turning Semi-Sync off on
4 # the master when still connected to a slave
5
6 --source include/have_binlog_format_mixed.inc # format-agnostic
7
8 --echo # Set up Semi-Sync with rpl_semi_sync_master_wait_no_slave=0
9 --let $rpl_skip_start_slave= 1
10 --source include/master-slave.inc
11
12 --let $orig_master_enabled=`SELECT @@GLOBAL.rpl_semi_sync_master_enabled`
13 SET @@GLOBAL.rpl_semi_sync_master_enabled= 1;
14 --let $orig_wait_no_slave=`SELECT @@GLOBAL.rpl_semi_sync_master_wait_no_slave`
15 SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= 0;
16
17 --connection slave
18 --let $orig_slave_enabled=`SELECT @@GLOBAL.rpl_semi_sync_slave_enabled`
19 SET @@GLOBAL.rpl_semi_sync_slave_enabled= 1;
20 --source include/start_slave.inc
21
22 --connection master
23 # Make sure Semi-Sync is active
24 --let $status_var= Rpl_semi_sync_master_status
25 --let $status_var_value= ON
26 --source include/wait_for_status_var.inc
27
28 --sync_slave_with_master
29 --connection master
30
31 --disable_cursor_protocol
32 SELECT ID INTO @binlog_dump_tid
33 FROM information_schema.PROCESSLIST WHERE COMMAND = 'Binlog Dump';
34 --enable_cursor_protocol
35
36 --echo # Wait for the Control State
37 let $wait_condition=
38 SELECT STATE LIKE 'Master has sent all binlog to slave%'
39 FROM information_schema.PROCESSLIST WHERE ID = @binlog_dump_tid;
40 --source include/wait_condition.inc
41 SHOW STATUS LIKE 'Rpl\_semi\_sync\_master\_clients';
42
43 --echo # Disable Semi-Sync while the dump thread is still connected to its slave
44 SET @@GLOBAL.rpl_semi_sync_master_enabled = 0;
45 --let $status_var_value= OFF
46 --source include/wait_for_status_var.inc
47
48 SELECT STATE FROM information_schema.PROCESSLIST WHERE ID = @binlog_dump_tid;
49 SHOW STATUS LIKE 'Rpl\_semi\_sync\_master\_clients';
50
51 --echo # Disconnect the slave and wait until the master's dump thread is gone
52 --connection slave
53 STOP SLAVE;
54 # Starting with MDEV-13073,
55 # Semi-Sync STOP SLAVE also terminates its dump thread on the master.
56 --connection master
57
58 # MDEV-36359: The disconnection would crash the master and leave the wait with
59 # error 2013 'Lost connection to server during query'
60 let $wait_condition= SELECT COUNT(*)=0
61 FROM information_schema.PROCESSLIST WHERE ID = @binlog_dump_tid;
62 --source include/wait_condition.inc
63 SHOW STATUS LIKE 'Rpl\_semi\_sync\_master\_clients';
64
65 --echo # Cleanup
66 --eval SET @@GLOBAL.rpl_semi_sync_master_enabled= $orig_master_enabled
67 --eval SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= $orig_wait_no_slave
68 --connection slave
69 --eval SET @@GLOBAL.rpl_semi_sync_slave_enabled= $orig_slave_enabled
70
71 --let $rpl_only_running_threads= 1
72 --source include/rpl_end.inc