Debian Codegraph @

mysql-test/suite/group_replication/t/gr_start_stop_slave_channel.test

raw
1 ################################################################################
2 # This test intends to prove that group replication channels are not affected
3 # by START SLAVE and STOP SLAVE commands.
4 #
5 # Test:
6 # 0) The test requires three servers: M1 and M2.
7 # 1) Bootstrap start a group on M1. Start GR on M2.
8 # 2) Create a slave channel 'channel_1' on M1 (M3 -> M1). Verify that both slave
9 # channel and group_replication_applier channel are present on M1.
10 # 3) With a running slave channel and group replication active do a STOP SLAVE.
11 # The slave channel should stop but the group replication channel shouldn't.
12 # 4) With a stopped slave channel and group replication off do a START SLAVE.
13 # The slave channel should start but the group replication channel shouldn't.
14 # 5) Restart the server with no automatic plugin start.
15 # The slave channel should start but the group replication channel shouldn't.
16 # 6) Clean up.
17 ################################################################################
18
19 --source include/have_group_replication_plugin.inc
20 --let $rpl_skip_group_replication_start= 1
21 --let $rpl_server_count= 3
22 --source include/group_replication.inc
23
24 #
25 # Phase 1: Start group replication on two servers
26 #
27
28 --connection server1
29 --echo server1
30 --source include/start_and_bootstrap_group_replication.inc
31
32 --connection server2
33 --echo server2
34 --source include/start_group_replication.inc
35
36 --connection server1
37 --let $group_replication_number_of_members= 2
38 --source include/gr_wait_for_number_of_members.inc
39
40 #
41 # Phase 2: Create a slave channel in server 1 and verify that 2 channels exist
42 #
43
44 --replace_result $SERVER_MYPORT_3 SERVER_3_PORT
45 --eval CHANGE REPLICATION SOURCE TO SOURCE_HOST="127.0.0.1", SOURCE_USER="root", SOURCE_PASSWORD="", SOURCE_PORT=$SERVER_MYPORT_3, SOURCE_AUTO_POSITION=1 FOR CHANNEL "channel_1"
46 --source include/start_slave.inc
47
48 --let $assert_text= 'The group replication applier channel is present'
49 --let $assert_cond= [SELECT COUNT(*) AS count FROM mysql.slave_relay_log_info WHERE channel_name="group_replication_applier", count, 1] = 1
50 --source include/assert.inc
51
52 --let $assert_text= 'The created slave channel is present'
53 --let $assert_cond= [SELECT COUNT(*) AS count FROM mysql.slave_relay_log_info WHERE channel_name="channel_1", count, 1] = 1
54 --source include/assert.inc
55
56 #
57 # Phase 3: Check that after doing a stop slave, the applier channel is still ON
58 #
59
60 --let $assert_text= 'The group replication applier channel is ON'
61 --let $assert_cond= [SELECT COUNT(*) AS count FROM performance_schema.replication_connection_status where CHANNEL_NAME="group_replication_applier" and SERVICE_STATE="ON", count, 1] = 1
62 --source include/assert.inc
63
64 --source include/stop_slave.inc
65
66 --let $assert_text= 'The group replication applier channel is still ON'
67 --let $assert_cond= [SELECT COUNT(*) AS count FROM performance_schema.replication_connection_status where CHANNEL_NAME="group_replication_applier" and SERVICE_STATE="ON", count, 1] = 1
68 --source include/assert.inc
69
70 --let $assert_text= 'The created slave channel is OFF'
71 --let $assert_cond= [SELECT COUNT(*) AS count FROM performance_schema.replication_connection_status where CHANNEL_NAME="channel_1" and SERVICE_STATE="OFF", count, 1] = 1
72 --source include/assert.inc
73
74 #
75 # Phase 4: After being stopped, check that after a START SLAVE the plugin channel is still OFF
76 #
77
78 --source include/stop_group_replication.inc
79
80 --let $assert_text= 'The group replication applier channel is OFF'
81 --let $assert_cond= [SELECT COUNT(*) AS count FROM performance_schema.replication_connection_status where CHANNEL_NAME="group_replication_applier" and SERVICE_STATE="OFF", count, 1] = 1
82 --source include/assert.inc
83
84 --source include/start_slave.inc
85
86 --let $assert_text= 'The group replication applier channel is still OFF'
87 --let $assert_cond= [SELECT COUNT(*) AS count FROM performance_schema.replication_connection_status where CHANNEL_NAME="group_replication_applier" and SERVICE_STATE="OFF", count, 1] = 1
88 --source include/assert.inc
89
90 --let $assert_text= 'The created slave channel is ON'
91 --let $assert_cond= [SELECT COUNT(*) AS count FROM performance_schema.replication_connection_status where CHANNEL_NAME="channel_1" and SERVICE_STATE="ON", count, 1] = 1
92 --source include/assert.inc
93
94 #
95 # Phase 5: On restart, only the slave channel should start
96 #
97
98 --connection server1
99 --let $allow_rpl_inited=1
100 --source include/restart_mysqld.inc
101
102 #Needed as we are not using rpl_restart_server.inc
103 --let $rpl_server_number= 1
104 --source include/rpl_reconnect.inc
105
106 # Wait for the slave channel start
107 --let $rpl_channel_name= 'channel_1'
108 --source include/wait_for_slave_to_start.inc
109 --let $rpl_channel_name=
110
111 --let $assert_text= 'The group replication applier channel is still OFF'
112 --let $assert_cond= [SELECT COUNT(*) AS count FROM performance_schema.replication_connection_status where CHANNEL_NAME="group_replication_applier" and SERVICE_STATE="OFF", count, 1] = 1
113 --source include/assert.inc
114
115 --let $assert_text= 'The created slave channel is ON'
116 --let $assert_cond= [SELECT COUNT(*) AS count FROM performance_schema.replication_connection_status where CHANNEL_NAME="channel_1" and SERVICE_STATE="ON", count, 1] = 1
117 --source include/assert.inc
118
119 #
120 # Phase 6: Clean the created channels
121 #
122
123 --source include/stop_slave.inc
124 CHANGE REPLICATION SOURCE TO SOURCE_AUTO_POSITION=0 FOR CHANNEL "channel_1";
125
126 --connection server1
127
128 --let $skip_restore_connection= 0
129 --source include/group_replication_end.inc
130