Debian Codegraph @

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

raw
1 #######################################################################################
2 # WL11570 - GR: options to defer member eviction after a suspicion
3 #
4 # In a group of 3 servers, we crash one of them and test if the
5 # non-responding server remains in the group for the configured waiting time,
6 # instead of being immediately expelled.
7 # Test :
8 # 0. This test requires 3 servers
9 # 1. Create a group replication setup with 3 members
10 # 2. Set the group_replication_member_expel_timeout parameter to 30 seconds
11 # 3. Crash server 3 and it will restart
12 # 4. Then check if server 3 is still in the group
13 # 5. 30 seconds later, server 3 should still be in the group as UNREACHABLE
14 # 6. After 5 seconds, server 3 should have been expelled from the group
15 # 7. Restart GR on server 3
16 # 8. Server 3 should be back in the group
17 #######################################################################################
18 # Don't test this under valgrind, memory leaks will occur
19 --source include/not_valgrind.inc
20 --source include/big_test.inc
21 --source include/have_group_replication_plugin.inc
22 --let $rpl_server_count= 3
23 --source include/force_restart.inc
24 --source include/group_replication.inc
25
26
27 --echo #
28 --echo # Set group_replication_member_expel_timeout to 15 seconds
29 --let $rpl_connection_name= server1
30 --source include/rpl_connection.inc
31 SET GLOBAL group_replication_member_expel_timeout = 15;
32 SELECT @@GLOBAL.group_replication_member_expel_timeout;
33
34 --let $rpl_connection_name= server2
35 --source include/rpl_connection.inc
36 SET GLOBAL group_replication_member_expel_timeout = 15;
37 SELECT @@GLOBAL.group_replication_member_expel_timeout;
38
39 --let $rpl_connection_name= server3
40 --source include/rpl_connection.inc
41 SET GLOBAL group_replication_member_expel_timeout = 15;
42 SELECT @@GLOBAL.group_replication_member_expel_timeout;
43
44 # Kill server3
45 --echo #
46 --echo # Crash server 3
47 --let $group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
48 --let $group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
49 --let $restart_parameters=restart:--group_replication_local_address=$group_replication_local_address --group_replication_group_seeds=$group_replication_group_seeds --group_replication_group_name=$group_replication_group_name
50 --replace_result $group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
51 --source include/kill_and_restart_mysqld.inc
52
53
54 --echo # Restarting server 3
55 # Needed as we are not using rpl_restart_server.inc
56 --let $rpl_server_number= 3
57 --source include/rpl_reconnect.inc
58
59
60 --echo #
61 --echo # Check that all members are still in the group on servers 1 and 2,
62 --echo # which should be ONLINE. Server 3 should still be in the group but
63 --echo # UNREACHABLE
64 --let $rpl_connection_name= server1
65 --source include/rpl_connection.inc
66 let $wait_condition=SELECT COUNT(*)=2 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE";
67 --source include/wait_condition.inc
68 let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.replication_group_members where MEMBER_STATE="UNREACHABLE";
69 --source include/wait_condition.inc
70
71
72 --let $rpl_connection_name= server2
73 --source include/rpl_connection.inc
74 let $wait_condition=SELECT COUNT(*)=2 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE";
75 --source include/wait_condition.inc
76 let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.replication_group_members where MEMBER_STATE="UNREACHABLE";
77 --source include/wait_condition.inc
78
79
80 --echo #
81 --echo # Check that server 3 has been removed from the group by servers 1 and 2
82 --let $rpl_connection_name= server1
83 --source include/rpl_connection.inc
84 let $wait_condition=SELECT COUNT(*)=2 FROM performance_schema.replication_group_members;
85 --source include/wait_condition.inc
86
87 --let $rpl_connection_name= server2
88 --source include/rpl_connection.inc
89 let $wait_condition=SELECT COUNT(*)=2 FROM performance_schema.replication_group_members;
90 --source include/wait_condition.inc
91
92
93 --echo #
94 --echo # Restarting GR on server3
95 --let $rpl_connection_name= server3
96 --source include/rpl_connection.inc
97 --source include/start_group_replication.inc
98
99
100 --echo #
101 --echo # Check that all 3 members are alive and online again in the group
102 --let $rpl_connection_name= server1
103 --source include/rpl_connection.inc
104 let $wait_condition=SELECT COUNT(*)=3 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE";
105 --source include/wait_condition.inc
106
107 --let $rpl_connection_name= server2
108 --source include/rpl_connection.inc
109 let $wait_condition=SELECT COUNT(*)=3 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE";
110 --source include/wait_condition.inc
111
112 --let $rpl_connection_name= server3
113 --source include/rpl_connection.inc
114 let $wait_condition=SELECT COUNT(*)=3 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE";
115 --source include/wait_condition.inc
116
117 --source include/group_replication_end.inc