Debian Codegraph @

mysql-test/suite/galera_3nodes/t/galera_join_with_cc_C.test

raw
1 #
2 # Tests handling of several configuration changes while a joiner gets
3 # state transfer
4 #
5 # Variant C: sending of state transfer request is scheduled while in non-PRIM
6 #
7 # Refs codersihp/galera-bugs#454
8 #
9 --source include/have_innodb.inc
10 --source include/galera_cluster.inc
11 --source include/galera_have_debug_sync.inc
12
13 --let $galera_connection_name = node_3
14 --let $galera_server_number = 3
15 --source include/galera_connect.inc
16
17 # Save original auto_increment_offset values.
18 --let $node_1=node_1
19 --let $node_2=node_2
20 --let $node_3=node_3
21 --source ../galera/include/auto_increment_offset_save.inc
22
23 --connection node_1
24 --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
25 --source include/wait_condition.inc
26
27 CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb;
28 INSERT INTO t1 VALUES (1, 1);
29
30 --connection node_2
31 --let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
32 --source include/wait_condition.inc
33
34 #
35 # Isolate node_1 and update cluster state to force node 1 into joiner mode
36 #
37 --connection node_1
38 SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
39
40 --connection node_2
41 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
42 --source include/wait_condition.inc
43
44 --connection node_3
45 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
46 --source include/wait_condition.inc
47
48 INSERT INTO t1 VALUES (2, 3);
49
50 --connection node_2
51 --let $wait_condition = SELECT COUNT(*) = 2 FROM t1;
52 --source include/wait_condition.inc
53
54 #
55 # Now reconnect node_1 but first make it block before sending state transfer
56 # request
57 #
58 # THIS IS PC1
59 #
60 --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
61 SET wsrep_sync_wait = 0;
62 SET wsrep_on = OFF;
63 --let $galera_sync_point = after_shift_to_joining
64 --source include/galera_set_sync_point.inc
65
66 --connection node_1
67 SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
68
69 --connection node_2
70 --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
71 --source include/wait_condition.inc
72
73 INSERT INTO t1 VALUES (3, 2);
74
75 --connection node_1a
76 --source include/galera_wait_sync_point.inc
77 #
78 # At this point every node thinks that node_1 is in a JOINER state
79 #
80
81 --connection node_3
82 --let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
83 --source include/wait_condition.inc
84
85 #
86 # Now that node_1 sent state request and became JOINER isolate node_1 again
87 # and commit one more action, so that node_1 loses JOINER state
88 #
89 --connection node_1
90 SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
91
92 --connection node_2
93 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
94 --source include/wait_condition.inc
95
96 --connection node_3
97 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
98 --source include/wait_condition.inc
99
100 INSERT INTO t1 VALUES (4, 3);
101
102 --connection node_2
103 --let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
104 --source include/wait_condition.inc
105
106 #
107 # Reconnect node_1 again
108 #
109 # THIS IS PC2
110 #
111 --connection node_1
112 SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
113
114 --connection node_2
115 --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
116 --source include/wait_condition.inc
117 #
118 # After this point node_1 is no longer JOINER and is required to start the
119 # whole procedure over because it missed some actions (4th insert into t1)
120 #
121
122 INSERT INTO t1 VALUES (5, 2);
123
124 --connection node_3
125 --let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
126 --source include/wait_condition.inc
127
128 #
129 # Now let node_1 continue with IST and finish processing PC1, but make it
130 # block when processing PC2 right after progressing to JOINER state and
131 # before IST happens.
132 #
133 --connection node_1a
134 --let $galera_sync_point = before_send_state_request
135 --source include/galera_set_sync_point.inc
136 --let $galera_sync_point = after_shift_to_joining
137 --source include/galera_signal_sync_point.inc
138 --let $galera_sync_point = before_send_state_request
139 --source include/galera_wait_sync_point.inc
140 --source include/galera_clear_sync_point.inc
141 # Here we are processing PC2 just before sending state request
142
143 # since PC1 has been processed node_1 must have 3 rows in t1
144 # 2 were there before PC1 and one was added while in PC1
145 --let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
146 --source include/wait_condition.inc
147
148 #
149 # Now disconnect and reconnect node_1 again to get PC3
150 # It still is blocked before sending state transfer request in PC2.
151 #
152 --connection node_1
153 SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
154
155 --connection node_2
156 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
157 --source include/wait_condition.inc
158
159 --connection node_3
160 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
161 --source include/wait_condition.inc
162
163 # Proceed to sending state transfer request
164 --connection node_1a
165 --let $galera_sync_point = after_shift_to_joining
166 --source include/galera_set_sync_point.inc
167 --let $galera_sync_point = before_send_state_request
168 --source include/galera_signal_sync_point.inc # before_send_state_request
169 #
170 # node_1 proceeds to sending state transfer request, it will be delivered only
171 # in the next PC which is PC3. Only then the node will shift to JOINING
172 #
173 --echo 4
174 SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters';
175
176 --connection node_3
177 INSERT INTO t1 VALUES (6, 3);
178
179 --connection node_2
180 --let $wait_condition = SELECT COUNT(*) = 6 FROM t1;
181 --source include/wait_condition.inc
182
183 --connection node_1
184 SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
185
186 --connection node_2
187 --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
188 --source include/wait_condition.inc
189 #
190 # This is PC3
191 #
192
193 INSERT INTO t1 VALUES (7, 2);
194
195 --connection node_3
196 --let $wait_condition = SELECT COUNT(*) = 7 FROM t1;
197 --source include/wait_condition.inc
198
199 # node_1 is stiil processing PC2, it was let to send state transfer request
200 # while in non-PRIM. Now it should be able to complete it and shift to
201 # JOINING. Make it block on next PC(3) and continue to receive IST
202 --connection node_1a
203 --let $galera_sync_point = after_shift_to_joining
204 --source include/galera_wait_sync_point.inc
205 --source include/galera_clear_sync_point.inc # won't need it any more
206 --let $galera_sync_point = process_primary_configuration
207 --source include/galera_set_sync_point.inc
208 --let $galera_sync_point = after_shift_to_joining
209 --source include/galera_signal_sync_point.inc
210 # continue with IST while still processing PC2
211
212 #
213 # Now disconnect and reconnect node_1 again to generate PC4.
214 #
215 --connection node_1
216 SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
217
218 --connection node_2
219 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
220 --source include/wait_condition.inc
221
222 --connection node_3
223 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
224 --source include/wait_condition.inc
225
226 INSERT INTO t1 VALUES (8, 3);
227
228 --connection node_2
229 --let $wait_condition = SELECT COUNT(*) = 8 FROM t1;
230 --source include/wait_condition.inc
231
232 --connection node_1
233 SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
234
235 --connection node_2
236 --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
237 --source include/wait_condition.inc
238 #
239 # This is PC4. node_1 should complete IST, complete PC2, and continue
240 # with the next item in queue
241 #
242 --connection node_1a
243 --let $galera_sync_point = process_primary_configuration
244 --source include/galera_wait_sync_point.inc
245
246 #
247 # Now node_1 is blocked before processing PC3, and should have finished state
248 # transfer started while in PC2.
249 # State tranfer request was dilivered in PC3 to donor, so node_1 should have
250 # received IST up to 6 rows in t1 (what was there before PC3).
251 #
252 --let $wait_condition = SELECT COUNT(*) = 6 FROM t1;
253 --source include/wait_condition.inc
254
255 --connection node_2
256 INSERT INTO t1 VALUES (9, 2);
257
258 --connection node_3
259 --let $wait_condition = SELECT COUNT(*) = 9 FROM t1;
260 --source include/wait_condition.inc
261
262 --connection node_1a
263 # continue with processing PC3
264 --let $galera_sync_point = process_primary_configuration
265 --source include/galera_signal_sync_point.inc
266
267 # wait for row that follows PC3
268 --let $wait_condition = SELECT COUNT(*) = 7 FROM t1;
269 --source include/wait_condition.inc
270
271 # wait till PC4
272 --let $galera_sync_point = process_primary_configuration
273 --source include/galera_wait_sync_point.inc
274 #
275 # Now node_1 is processing PC4, still must have 7 rows in t1
276 #
277 --let $wait_condition = SELECT COUNT(*) = 7 FROM t1;
278 --source include/wait_condition.inc
279
280 # Continue with PC4
281 --let $galera_sync_point = process_primary_configuration
282 --source include/galera_clear_sync_point.inc
283 --source include/galera_signal_sync_point.inc
284 --let $galera_sync_point = after_shift_to_joining
285 --source include/galera_wait_sync_point.inc
286 --source include/galera_clear_sync_point.inc
287 --source include/galera_signal_sync_point.inc
288
289 --let $wait_condition = SELECT COUNT(*) = 9 FROM t1;
290 --source include/wait_condition.inc
291
292 --connection node_1
293 --let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
294 --source include/wait_condition.inc
295
296 DROP TABLE t1;
297
298 call mtr.add_suppression("WSREP: Send action {.* STATE_REQUEST} returned -107 \\((Transport endpoint|Socket) is not connected\\)");
299 call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\.");
300
301 --connection node_2
302 call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\.");
303
304 --connection node_3
305 call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\.");
306
307 --source ../galera/include/auto_increment_offset_restore.inc