Debian Codegraph @

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

raw
1 #######################################################################################
2 # WL11570 - GR: options to defer member eviction after a suspicion
3 #
4 # In a group of 4 servers, we suspend one of them for 300 seconds and test if it is
5 # possible to remove a node. The current behavior does not allow the removal of a
6 # node from the group and this is verified.
7 #
8 # 1. Create a group with 4 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, 2 and 4, which should
14 # be ONLINE.
15 # Server 3 should still be in the group but UNREACHABLE.
16 # 5. Make server 4 leave the group and notice that it is reported as ONLINE and server
17 # 3 as UNREACHABLE.
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 --source include/big_test.inc
30 --source include/force_restart.inc
31 --source include/have_group_replication_plugin.inc
32
33 --echo
34 --echo ############################################################
35 --echo # 1. Create a group with 4 members and a table on it.
36 --let $rpl_server_count= 4
37 --source include/group_replication.inc
38
39 --let $rpl_connection_name= server1
40 --source include/rpl_connection.inc
41 --let $server1_local_address= `SELECT @@GLOBAL.group_replication_local_address`
42
43 --echo #
44 --echo # Create a table
45 --let $rpl_connection_name= server1
46 --source include/rpl_connection.inc
47 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
48 INSERT INTO t1 VALUES (1);
49 --source include/rpl_sync.inc
50
51 --let $rpl_connection_name= server4
52 --source include/rpl_connection.inc
53 set session sql_log_bin=0;
54 call mtr.add_suppression("Timeout on wait for view after joining group");
55 call mtr.add_suppression("The member is leaving a group without being on one");
56 call mtr.add_suppression("The member has left the group but the new view will not be installed");
57 set session sql_log_bin=1;
58
59 --echo
60 --echo ############################################################
61 --echo # 2. Set group_replication_member_expel_timeout to
62 --echo # 300 seconds.
63 --let $rpl_connection_name= server1
64 --source include/rpl_connection.inc
65 SET GLOBAL group_replication_member_expel_timeout = 300;
66 SELECT @@GLOBAL.group_replication_member_expel_timeout;
67
68 --let $rpl_connection_name= server2
69 --source include/rpl_connection.inc
70 SET GLOBAL group_replication_member_expel_timeout = 300;
71 SELECT @@GLOBAL.group_replication_member_expel_timeout;
72
73 --let $rpl_connection_name= server3
74 --source include/rpl_connection.inc
75 SET GLOBAL group_replication_member_expel_timeout = 300;
76 SELECT @@GLOBAL.group_replication_member_expel_timeout;
77
78 --let $rpl_connection_name= server4
79 --source include/rpl_connection.inc
80 SET GLOBAL group_replication_member_expel_timeout = 300;
81 SELECT @@GLOBAL.group_replication_member_expel_timeout;
82
83 --echo
84 --echo ############################################################
85 --echo # 3. Suspend server 3 by sending signal SIGSTOP to it.
86 --echo # This will make server 3 not answer to "I am alive"
87 --echo # GCS messages and it will eventually be considered
88 --echo # faulty.
89 --let $rpl_connection_name= server3
90 --source include/rpl_connection.inc
91
92 --echo #
93 --echo # Get server 3 pid.
94 SET SESSION sql_log_bin= 0;
95 CREATE TABLE pid_table(pid_no INT);
96 --let $pid_file= `SELECT @@GLOBAL.pid_file`
97 --replace_result $pid_file pid_file
98 --eval LOAD DATA LOCAL INFILE '$pid_file' INTO TABLE pid_table
99 --let $server_pid=`SELECT pid_no FROM pid_table`
100 DROP TABLE pid_table;
101 SET SESSION sql_log_bin= 1;
102
103 --echo #
104 --echo # Suspending server 3...
105 --exec kill -19 $server_pid
106
107 --echo
108 --echo ############################################################
109 --echo # 4. Check that all members are still in the group on
110 --echo # servers 1, 2 and 4 which should be ONLINE.
111 --echo # Server 3 should still be in the group but UNREACHABLE.
112
113 --let $rpl_connection_name= server1
114 --source include/rpl_connection.inc
115 let $wait_condition=SELECT COUNT(*)=3 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE";
116 --source include/wait_condition.inc
117 let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.replication_group_members where MEMBER_STATE="UNREACHABLE";
118 --source include/wait_condition.inc
119
120 --echo
121 --echo ############################################################
122 --echo # 5. Make server 4 leave the group and notice that it is
123 --echo # reported as ONLINE and server 3 as UNREACHABLE.
124 --echo #
125 --echo # Stop GR on server4.
126 --let $rpl_connection_name= server4
127 --source include/rpl_connection.inc
128 --source include/stop_group_replication.inc
129
130 --let $rpl_connection_name= server1
131 --source include/rpl_connection.inc
132 let $wait_condition=SELECT COUNT(*)=3 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE";
133 --source include/wait_condition.inc
134 let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.replication_group_members where MEMBER_STATE="UNREACHABLE";
135 --source include/wait_condition.inc
136
137 --echo
138 --echo ############################################################
139 --echo # 6. Reset the group_replication_member_expel_timeout
140 --echo # parameter to 0 seconds thus forcing server 3 to be
141 --echo # expelled.
142 --echo #
143 --echo # Reset the group_replication_member_expel_timeout to 0.
144
145 --let $rpl_connection_name= server1
146 --source include/rpl_connection.inc
147 SET GLOBAL group_replication_member_expel_timeout = 0;
148
149 --let $rpl_connection_name= server2
150 --source include/rpl_connection.inc
151 SET GLOBAL group_replication_member_expel_timeout = 0;
152
153 --let $rpl_connection_name= server4
154 --source include/rpl_connection.inc
155 SET GLOBAL group_replication_member_expel_timeout = 0;
156
157 --echo #
158 --echo # Wait until until server 3 is expelled and 2 servers are online
159 --let $rpl_connection_name= server1
160 --source include/rpl_connection.inc
161 let $wait_condition=SELECT COUNT(*)=2 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE";
162 --source include/wait_condition.inc
163
164 --echo
165 --echo #############################################################
166 --echo # 7. Make server 4 successfully join the group after reseting
167 --echo # the above option.
168 --echo #
169 --echo # Start GR on server4
170 --let $rpl_connection_name= server4
171 --source include/rpl_connection.inc
172 --replace_result $server1_local_address SERVER1_LOCAL_ADDRESS
173 --eval SET GLOBAL group_replication_group_seeds= "$server1_local_address"
174 --source include/start_group_replication.inc
175
176 --echo #############################################################
177 --echo # 8. Resume server 3 and make it rejoin the group
178 --echo #
179 --exec kill -18 $server_pid
180
181
182 --let $rpl_connection_name= server3
183 --source include/rpl_connection.inc
184 # Due to BUG#28068548 and BUG#28224165 we cannot check the server status as it
185 # may report that the server never left the group.
186 #let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE" or MEMBER_STATE="ERROR";
187 #--source include/wait_condition.inc
188 --source include/stop_group_replication.inc
189 --source include/start_group_replication.inc
190
191 --echo #
192 --echo # Wait until until all servers are online again
193 --let $rpl_connection_name= server1
194 --source include/rpl_connection.inc
195 let $wait_condition=SELECT COUNT(*)=4 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE";
196 --source include/wait_condition.inc
197
198 --echo
199 --echo ############################################################
200 --echo # 9. Clean up.
201 --let $rpl_connection_name= server1
202 --source include/rpl_connection.inc
203 DROP TABLE t1;
204 --source include/rpl_sync.inc
205
206 --source include/group_replication_end.inc