Debian Codegraph @

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

raw
1 ###############################################################################
2 # Perform some tests about getting/setting communication_protocol when there
3 # are different member states in the group.
4 #
5 # This test uses 3 servers.
6 #
7 # Test:
8 # 1. Start 3 servers and add them into group replication group.
9 # 2. Check that it is *not* possible to modify the communication_protocol
10 # value via an ONLINE member when some other member is in RECOVERING state.
11 # 3. Check that it is *not* possible to modify the communication_protocol
12 # value via a RECOVERING member.
13 # 4. Check that it is possible to query the communication_protocol value via
14 # an ONLINE member when some other members are in RECOVERING state.
15 # 5. Check that it is *not* possible to query the communication_protocol
16 # value via a RECOVERING member.
17 # 6. Check that it is *not* possible to modify the communication_protocol
18 # value via an ONLINE member when some member is in UNREACHABLE state.
19 # 7. Check that it is possible to query the communication_protocol value via
20 # an ONLINE member when a minority of members are UNREACHABLE.
21 # 8. Check that it is *not* possible to query the communication_protocol
22 # value via an ONLINE member when a majority of members are UNREACHABLE.
23 ################################################################################
24 # This test crashes servers, thence we skip it on valgrind.
25 --source include/not_valgrind.inc
26 --source include/big_test.inc
27 --source include/have_debug_sync.inc
28 --source include/force_restart.inc
29 --source include/have_group_replication_plugin.inc
30 --let $rpl_server_count= 3
31 --source include/group_replication.inc
32
33 --let $rpl_connection_name= server2
34 --source include/rpl_connection.inc
35
36 # Will be used to recover server2 later on.
37 --let $local_address_server2= `SELECT @@GLOBAL.group_replication_local_address`
38 --let $group_seeds_server2= `SELECT @@GLOBAL.group_replication_group_seeds`
39
40 --let $rpl_connection_name= server3
41 --source include/rpl_connection.inc
42 # Will be used to recover server3 later on.
43 --let $local_address_server3= `SELECT @@GLOBAL.group_replication_local_address`
44 --let $group_seeds_server3= `SELECT @@GLOBAL.group_replication_group_seeds`
45
46 --let $rpl_connection_name= server1
47 --source include/rpl_connection.inc
48 # Will be used to hide the result of `group_replication_get_communication_protocol` later on.
49 --let $gr_communication_protocol_version= `SELECT group_replication_get_communication_protocol()`
50
51 --echo ###############################################################################
52 --echo # 2. Check that it is *not* possible to modify the communication_protocol value via an ONLINE member when some other member is in RECOVERING state.
53 # Stop GR on server2.
54 --let $rpl_connection_name= server2
55 --source include/rpl_connection.inc
56 --source include/stop_group_replication.inc
57
58 # Start GR on server2, it stays RECOVERING.
59 --let $rpl_connection_name= server2
60 --source include/rpl_connection.inc
61 SET @@GLOBAL.DEBUG='+d,recovery_thread_wait_before_finish';
62
63 --let $group_replication_start_member_state= RECOVERING
64 --source include/start_group_replication.inc
65
66 # We cannot modify the communication_protocol value on server1 since server2 is RECOVERING.
67 --let $rpl_connection_name= server1
68 --source include/rpl_connection.inc
69 --error ER_CANT_INITIALIZE_UDF
70 SELECT group_replication_set_communication_protocol("5.7.14");
71
72 --echo ###############################################################################
73 --echo # 3. Check that it is *not* possible to modify the communication_protocol value via a RECOVERING member.
74 --let $rpl_connection_name= server2
75 --source include/rpl_connection.inc
76 --error ER_CANT_INITIALIZE_UDF
77 SELECT group_replication_set_communication_protocol("5.7.14");
78
79 --echo ###############################################################################
80 --echo # 4. Check that it is possible to query the communication_protocol value via an ONLINE member when some other members are in RECOVERING state.
81 --let $rpl_connection_name= server1
82 --source include/rpl_connection.inc
83 --replace_result $gr_communication_protocol_version GR_COMMUNICATION_PROTOCOL_VERSION
84 SELECT group_replication_get_communication_protocol();
85
86 --echo ###############################################################################
87 --echo # 5. Check that it is *not* possible to query the communication_protocol value via a RECOVERING member.
88 --let $rpl_connection_name= server2
89 --source include/rpl_connection.inc
90 --error ER_CANT_INITIALIZE_UDF
91 SELECT group_replication_get_communication_protocol();
92
93 # Wait until server2 becomes ONLINE
94 --let $rpl_connection_name= server2
95 --source include/rpl_connection.inc
96 SET DEBUG_SYNC= "now WAIT_FOR signal.recovery_thread_wait_before_finish_reached";
97 SET @@GLOBAL.DEBUG='-d,recovery_thread_wait_before_finish';
98 SET DEBUG_SYNC= "now SIGNAL signal.recovery_end";
99
100 --echo Wait until server2 becomes ONLINE
101 --let $group_replication_member_state= ONLINE
102 --source include/gr_wait_for_member_state.inc
103
104 SET DEBUG_SYNC= 'RESET';
105
106 --echo ###############################################################################
107 --echo # 6. Check that it is *not* possible to modify the communication_protocol value via an ONLINE member when some member is in UNREACHABLE state.
108 # Crash server2
109 #
110 # We kill and restart the server. We wait for the server to start.
111 #
112 # However, since the server loses its GCS configuration they will not rejoin
113 # the group.
114 --let $member2_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
115
116
117
118 --source include/kill_and_restart_mysqld.inc
119
120 # Wait for the member state be unreachable.
121 --let $rpl_connection_name= server_1
122 --source include/rpl_connection.inc
123 --let $group_replication_member_state= UNREACHABLE
124 --let $group_replication_member_id= $member2_uuid
125 --source include/gr_wait_for_member_state.inc
126
127 --error ER_CANT_INITIALIZE_UDF
128 SELECT group_replication_set_communication_protocol("5.7.14");
129
130 --echo ###############################################################################
131 --echo # 7. Check that it is possible to query the communication_protocol value via an ONLINE member when a minority of members are UNREACHABLE.
132 --replace_result $gr_communication_protocol_version GR_COMMUNICATION_PROTOCOL_VERSION
133 SELECT group_replication_get_communication_protocol();
134
135 --echo ###############################################################################
136 --echo # 8. Check that it is *not* possible to query the communication_protocol value via an ONLINE member when a majority of members are UNREACHABLE.
137 # Crash server3
138 #
139 # We kill and restart the server. We wait for the server to start.
140 #
141 # However, since the server loses its GCS configuration they will not rejoin
142 # the group.
143 --let $rpl_connection_name= server3
144 --source include/rpl_connection.inc
145
146 --let $member3_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
147
148 --source include/kill_and_restart_mysqld.inc
149
150 # Wait for the member state be unreachable.
151 --let $rpl_connection_name= server_1
152 --source include/rpl_connection.inc
153 --let $group_replication_member_state= UNREACHABLE
154 --let $group_replication_member_id= $member3_uuid
155 --source include/gr_wait_for_member_state.inc
156
157 --error ER_CANT_INITIALIZE_UDF
158 SELECT group_replication_get_communication_protocol();
159
160 --echo ###############################################################################
161 --echo # 9. Cleanup
162 # We have lost majority, so forcefully remove server2 and server3 from the membership.
163 --let $rpl_connection_name= server1
164 --source include/rpl_connection.inc
165 --let $local_address_server1= `SELECT @@GLOBAL.group_replication_local_address`
166 --disable_query_log
167 --eval SET GLOBAL group_replication_force_members= "$local_address_server1"
168 --enable_query_log
169
170 # Add server2 back to the group.
171 --let $rpl_server_number= 2
172 --source include/rpl_reconnect.inc
173
174 --let $rpl_connection_name= server_2
175 --source include/rpl_connection.inc
176
177 --replace_result $group_seeds_server2 GROUP_SEEDS_SERVER2
178 --eval SET @@global.group_replication_group_seeds="$group_seeds_server2"
179 --replace_result $local_address_server2 LOCAL_ADDRESS_SERVER2
180 --eval SET @@global.group_replication_local_address="$local_address_server2"
181 --replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
182 --eval SET @@global.group_replication_group_name="$group_replication_group_name"
183
184 --source include/start_group_replication.inc
185
186 # Add server3 back to the group.
187 --let $rpl_server_number= 3
188 --source include/rpl_reconnect.inc
189
190 --let $rpl_connection_name= server_3
191 --source include/rpl_connection.inc
192
193 --replace_result $group_seeds_server3 GROUP_SEEDS_SERVER3
194 --eval SET @@global.group_replication_group_seeds="$group_seeds_server3"
195 --replace_result $local_address_server3 LOCAL_ADDRESS_SERVER3
196 --eval SET @@global.group_replication_local_address="$local_address_server3"
197 --replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
198 --eval SET @@global.group_replication_group_name="$group_replication_group_name"
199
200 --source include/start_group_replication.inc
201
202 # Validate that there are 3 servers in the group.
203 --let $rpl_connection_name= server1
204 --source include/rpl_connection.inc
205 --let $group_replication_number_of_members= 3
206 --source include/gr_wait_for_number_of_members.inc
207
208 --source include/group_replication_end.inc