Debian Codegraph @

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

raw
1 #######################################################################################
2 # WL11570 - GR: options to defer member eviction after a suspicion
3 #
4 # In a group of 3 servers, we suspend one of them for 300 seconds and test if it is
5 # possible to add a fourth node to the group. The current behavior does not allow
6 # the addition of a node to the group and this is verified.
7 #
8 # 1. Create a group with 3 servers and a table on it.
9 # 2. Set the group_replication_member_expel_timeout parameter to 300 seconds
10 # 3. Suspend server 3 by sending a signal SIGSTOP to it.
11 # This will make server 3 not answer to "I am alive" GCS messages and it will
12 # eventually be considered faulty.
13 # 4. Check that all members are still in the group on servers 1 and 2, which should
14 # both be ONLINE.
15 # Server 3 should still be in the group but UNREACHABLE.
16 # 5. Try to make server 4 join the group will fail while server 3 is UNREACHABLE.
17 # Note also that server 3 is not expelled from the group.
18 # 6. Reset the group_replication_member_expel_timeout parameter to 0 seconds thus
19 # forcing server 3 to be expelled.
20 # 7. Make server 4 successfully join the group after reseting the above option.
21 # 8. Resume server 3 and make it rejoin the group.
22 # 9. Clean up.
23 #######################################################################################
24
25 # Don't test this under valgrind, memory leaks will occur
26 --source include/not_valgrind.inc
27 # Test involves sending SIGSTOP and SIGCONT signals using kill Linux command.
28 --source include/linux.inc
29 # Only run in XCom due to connection issues with MySQL stack
30 --source include/have_group_replication_xcom_communication_stack.inc
31 --source include/big_test.inc
32 --source include/force_restart.inc
33 --source include/have_group_replication_plugin.inc
34 --let $rpl_server_count= 4
35 --let $rpl_skip_group_replication_start= 1
36 --source include/group_replication.inc
37
38 --echo
39 --echo ############################################################
40 --echo # 1. Create a group with 3 members and a table on it.
41 --echo #
42 --echo # Start GR on server1.
43 --let $rpl_connection_name= server1
44 --source include/rpl_connection.inc
45 --source include/start_and_bootstrap_group_replication.inc
46 --let $server1_local_address= `SELECT @@GLOBAL.group_replication_local_address`
47
48 --echo #
49 --echo # Start GR on server2.
50 --let $rpl_connection_name= server2
51 --source include/rpl_connection.inc
52 --source include/start_group_replication.inc
53
54 --echo #
55 --echo # Start GR on server3.
56 --let $rpl_connection_name= server3
57 --source include/rpl_connection.inc
58 --source include/start_group_replication.inc
59
60 --echo #
61 --echo # Create a table
62 --let $rpl_connection_name= server1
63 --source include/rpl_connection.inc
64 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
65 INSERT INTO t1 VALUES (1);
66 --source include/rpl_sync.inc
67
68 --let $rpl_connection_name= server4
69 --source include/rpl_connection.inc
70 set session sql_log_bin=0;
71 call mtr.add_suppression("Timeout on wait for view after joining group");
72 call mtr.add_suppression("The member is leaving a group without being on one");
73 call mtr.add_suppression("The member has left the group but the new view will not be installed");
74 set session sql_log_bin=1;
75
76 --echo
77 --echo ############################################################
78 --echo # 2. Set group_replication_member_expel_timeout to
79 --echo # 300 seconds.
80 --let $rpl_connection_name= server1
81 --source include/rpl_connection.inc
82 SET GLOBAL group_replication_member_expel_timeout = 300;
83 SELECT @@GLOBAL.group_replication_member_expel_timeout;
84
85 --let $rpl_connection_name= server2
86 --source include/rpl_connection.inc
87 SET GLOBAL group_replication_member_expel_timeout = 300;
88 SELECT @@GLOBAL.group_replication_member_expel_timeout;
89
90 --let $rpl_connection_name= server3
91 --source include/rpl_connection.inc
92 SET GLOBAL group_replication_member_expel_timeout = 300;
93 SELECT @@GLOBAL.group_replication_member_expel_timeout;
94
95 --let $rpl_connection_name= server4
96 --source include/rpl_connection.inc
97 SET GLOBAL group_replication_member_expel_timeout = 300;
98 SELECT @@GLOBAL.group_replication_member_expel_timeout;
99
100 --echo
101 --echo ############################################################
102 --echo # 3. Suspend server 3 by sending signal SIGSTOP to it.
103 --echo # This will make server 3 not answer to "I am alive"
104 --echo # GCS messages and it will eventually be considered
105 --echo # faulty.
106 --let $rpl_connection_name= server3
107 --source include/rpl_connection.inc
108
109 --echo #
110 --echo # Get server 3 pid.
111 SET SESSION sql_log_bin= 0;
112 CREATE TABLE pid_table(pid_no INT);
113 --let $pid_file= `SELECT @@GLOBAL.pid_file`
114 --replace_result $pid_file pid_file
115 --eval LOAD DATA LOCAL INFILE '$pid_file' INTO TABLE pid_table
116 --let $server_pid=`SELECT pid_no FROM pid_table`
117 DROP TABLE pid_table;
118 SET SESSION sql_log_bin= 1;
119
120 --echo #
121 --echo # Suspending server 3...
122 --exec kill -19 $server_pid
123
124 --echo
125 --echo ############################################################
126 --echo # 4. Check that all members are still in the group on
127 --echo # servers 1 and 2, which should both be ONLINE.
128 --echo # Server 3 should still be in the group but UNREACHABLE.
129 --echo # After more than 10 seconds nobody left the group.
130
131 --let $rpl_connection_name= server1
132 --source include/rpl_connection.inc
133 let $wait_condition=SELECT COUNT(*)=2 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE";
134 --source include/wait_condition.inc
135 let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.replication_group_members where MEMBER_STATE="UNREACHABLE";
136 --source include/wait_condition.inc
137
138 --echo
139 --echo ############################################################
140 --echo # 5. Try to make server 4 join the group will fail while
141 --echo # server 3 is UNREACHABLE.
142 --echo # Note also that server 3 is not expelled from the group.
143 --echo #
144 --echo # Try to start GR on server4.
145 --let $rpl_connection_name= server4
146 --source include/rpl_connection.inc
147
148 --let $group_replication_comm_stack= `SELECT @@GLOBAL.group_replication_communication_stack`
149
150 --replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
151 --eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
152 --replace_result $server1_local_address SERVER1_LOCAL_ADDRESS
153 --eval SET GLOBAL group_replication_group_seeds= "$server1_local_address"
154 --error ER_GROUP_REPLICATION_CONFIGURATION
155 START GROUP_REPLICATION;
156
157 --let $rpl_connection_name= server1
158 --source include/rpl_connection.inc
159 let $wait_condition=SELECT COUNT(*)=2 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE";
160 --source include/wait_condition.inc
161 let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.replication_group_members where MEMBER_STATE="UNREACHABLE";
162 --source include/wait_condition.inc
163
164 --echo
165 --echo ############################################################
166 --echo # 6. Reset the group_replication_member_expel_timeout
167 --echo # parameter to 0 seconds thus forcing server 3 to be
168 --echo # expelled.
169 --echo #
170 --echo # Reset the group_replication_member_expel_timeout to 0.
171
172 --let $rpl_connection_name= server1
173 --source include/rpl_connection.inc
174 SET GLOBAL group_replication_member_expel_timeout = 0;
175
176 --let $rpl_connection_name= server2
177 --source include/rpl_connection.inc
178 SET GLOBAL group_replication_member_expel_timeout = 0;
179
180 --let $rpl_connection_name= server4
181 --source include/rpl_connection.inc
182 SET GLOBAL group_replication_member_expel_timeout = 0;
183
184 --echo #
185 --echo # Wait until server 3 is expelled and 2 servers are online
186 --let $rpl_connection_name= server1
187 --source include/rpl_connection.inc
188 let $wait_condition=SELECT COUNT(*)=2 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE";
189 --source include/wait_condition.inc
190 let $wait_condition=SELECT COUNT(*)=0 FROM performance_schema.replication_group_members where MEMBER_STATE="UNREACHABLE";
191 --source include/wait_condition.inc
192
193 --echo
194 --echo #############################################################
195 --echo # 7. Make server 4 successfully join the group after reseting
196 --echo # the above option.
197 --echo #
198 --echo # Start GR on server4
199 --let $rpl_connection_name= server4
200 --source include/rpl_connection.inc
201 --source include/start_group_replication.inc
202
203 --echo #############################################################
204 --echo # 8. Resume server3 and make it rejoin the group
205 --echo #
206 --exec kill -18 $server_pid
207
208 --let $rpl_connection_name= server3
209 --source include/rpl_connection.inc
210 # Due to BUG#28068548 and BUG#28224165 we cannot check the server status as it
211 # may report that the server never left the group.
212 #let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE" or MEMBER_STATE="ERROR";
213 #--source include/wait_condition.inc
214 --source include/stop_group_replication.inc
215 --source include/start_group_replication.inc
216
217 --echo #
218 --echo # Wait until until all servers are online again
219 --let $rpl_connection_name= server1
220 --source include/rpl_connection.inc
221 let $wait_condition=SELECT COUNT(*)=4 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE";
222 --source include/wait_condition.inc
223
224 --echo
225 --echo ############################################################
226 --echo # 9. Clean up.
227 --let $rpl_connection_name= server1
228 --source include/rpl_connection.inc
229 DROP TABLE t1;
230 --source include/rpl_sync.inc
231
232 --source include/group_replication_end.inc