Debian Codegraph @

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

raw
1 # ==== Purpose ====
2 #
3 # This test will create two channels and will make one of them to be blocked
4 # while stopping.
5 #
6 # Then, the test case shows that it is possible to execute SHOW SLAVE STATUS
7 # for the channel being stopped, as well as to stop another channel.
8 #
9 # ==== Related Bugs and Worklogs ====
10 #
11 # BUG#20593028 MORE CONCURRENCY IN SHOW SLAVE STATUS: MAKE LOCK_MSR_MAP
12 # AN RWLOCK
13
14 --source include/not_group_replication_plugin.inc
15 # This test case is binary log format agnostic
16 --source include/have_binlog_format_row.inc
17 # Test requires master-info-repository=TABLE, relay-log-info-repository=TABLE
18 --source include/have_slave_repository_type_table.inc
19 --let $rpl_skip_start_slave= 1
20 --let $rpl_extra_connections_per_server= 2
21 --source include/master-slave.inc
22
23 # Create two slave channels
24 --source include/rpl_connection_slave.inc
25 --disable_warnings
26 --replace_result $MASTER_MYPORT MASTER_PORT
27 --eval CHANGE REPLICATION SOURCE TO SOURCE_USER='root', SOURCE_HOST='127.0.0.1', SOURCE_PORT=$MASTER_MYPORT FOR CHANNEL 'ch1'
28 --replace_result $MASTER_MYPORT MASTER_PORT
29 --eval CHANGE REPLICATION SOURCE TO SOURCE_USER='root', SOURCE_HOST='dummyhost', SOURCE_PORT=$MASTER_MYPORT FOR CHANNEL 'ch2'
30 --enable_warnings
31
32 # Start both threads of only one of the channels
33 --let $rpl_channel_name= 'ch1'
34 --source include/start_slave.inc
35 # Start only the SQL thread for the other channel
36 --let $rpl_channel_name= 'ch2'
37 --source include/start_slave_sql.inc
38
39 # Create a table on the master
40 --source include/rpl_connection_master.inc
41 CREATE TABLE t1 (c1 INT PRIMARY KEY) ENGINE=InnoDB;
42 --let $rpl_channel_name= 'ch1'
43 --source include/sync_slave_sql_with_master.inc
44
45 # To block ch1 SQL thread
46 --source include/rpl_connection_slave1.inc
47 BEGIN;
48 INSERT INTO t1 VALUES (1);
49
50 # Generate data at the master to be replicated
51 --source include/rpl_connection_master.inc
52 INSERT INTO t1 VALUES (1);
53 # Make sure the I/O thread received the new data
54 --source include/sync_slave_io_with_master.inc
55
56 --send STOP SLAVE SQL_THREAD FOR CHANNEL 'ch1'
57
58 --let $rpl_connection_name= server_2_2
59 --source include/rpl_connection.inc
60 --let $ch1_sql_running=query_get_value(SHOW SLAVE STATUS FOR CHANNEL 'ch1', Slave_SQL_Running, 1)
61 --let $assert_cond= [ SELECT "$ch1_sql_running" = "Yes" ]
62 --let $assert_text= SQL thread for ch1 is running
63 --source include/assert.inc
64 --let $ch1_sql_status=query_get_value(SHOW SLAVE STATUS FOR CHANNEL 'ch1', Slave_SQL_Running_State, 1)
65 # This is the expected state with a non-MTS slave.
66 --let $cond1 = "System lock"
67 # This is the expected state with a MTS slave.
68 --let $cond2 = "Waiting for workers to exit"
69 # This is the state that the thread has while applying RBR events
70 --let $cond4 = "Applying batch of row changes (write)"
71 --let $assert_cond= [ SELECT "$ch1_sql_status" = $cond1 OR "$ch1_sql_status" = $cond2 OR "$ch1_sql_status" = $cond4 ]
72 --let $assert_text= SQL thread for ch1 running state is $cond1 or $cond2 or $cond4
73 --source include/assert.inc
74
75 --echo Stop ch2 SQL thread while stopping ch1 SQL thread
76 STOP SLAVE SQL_THREAD FOR CHANNEL 'ch2';
77 --let $rpl_channel_name= 'ch2'
78 --source include/wait_for_slave_sql_to_stop.inc
79
80 --let $ch1_sql_running=query_get_value(SHOW SLAVE STATUS FOR CHANNEL 'ch1', Slave_SQL_Running, 1)
81 --let $assert_cond= [ SELECT "$ch1_sql_running" = "Yes" ]
82 --let $assert_text= SQL thread for ch1 is still running
83 --source include/assert.inc
84
85 # Now we can let the ch1 SQL thread to stop
86 --source include/rpl_connection_slave1.inc
87 ROLLBACK;
88
89 --source include/rpl_connection_slave.inc
90 --reap
91 --let $rpl_channel_name= 'ch1'
92 --source include/wait_for_slave_sql_to_stop.inc
93
94 # Cleanup
95 --let $rpl_channel_name=
96 STOP SLAVE IO_THREAD FOR CHANNEL 'ch1';
97 RESET SLAVE ALL;
98 RESET MASTER;
99 DROP TABLE t1;
100 --disable_warnings
101 --replace_result $MASTER_MYPORT MASTER_PORT
102 --eval CHANGE REPLICATION SOURCE TO SOURCE_USER='root', SOURCE_HOST='127.0.0.1', SOURCE_PORT=$MASTER_MYPORT
103 --enable_warnings
104 --source include/start_slave.inc
105 --source include/rpl_connection_master.inc
106 DROP TABLE t1;
107 --source include/rpl_end.inc