Debian Codegraph @

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

raw
1 #
2 # This test creates 2x 3 nodes galera cluster.
3 # The whole test case
4 # A <-> B <-> C {Galera cluster 1}
5 # | {Circular Async replication}
6 # D <-> E <-> F {Galera cluster 2}
7 # We will write on any random node to see if gtid is consitent or not
8 # Then we will kill node D and set up the replication between A and E
9 # To see whether fail over works or not.
10
11 --source include/big_test.inc
12 --source include/galera_cluster.inc
13 --source include/have_innodb.inc
14 --source include/force_restart.inc
15
16 --connection node_1
17 --echo cluster 1 node 1
18 SHOW STATUS LIKE 'wsrep_cluster_size';
19
20 --connection node_2
21 --echo cluster 1 node 2
22 SHOW STATUS LIKE 'wsrep_cluster_size';
23
24 --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
25 --connection node_3
26 --echo cluster 1 node 3
27 SHOW STATUS LIKE 'wsrep_cluster_size';
28
29 --connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4
30 --connection node_4
31 --echo cluster 2 node 1
32 SHOW STATUS LIKE 'wsrep_cluster_size';
33
34 --connect node_5, 127.0.0.1, root, , test, $NODE_MYPORT_5
35 --connection node_5
36 --echo cluster 2 node 2
37 SHOW STATUS LIKE 'wsrep_cluster_size';
38
39 --connect node_6, 127.0.0.1, root, , test, $NODE_MYPORT_6
40 --connection node_6
41 --echo cluster 2 node 3
42 SHOW STATUS LIKE 'wsrep_cluster_size';
43 #--disable_parsing
44 --connection node_1
45 --echo --- ignore_server_ids=(12,13)
46 --disable_query_log
47 --eval change master to master_host='127.0.0.1', master_user='root', MASTER_SSL_VERIFY_SERVER_CERT=0, master_port=$NODE_MYPORT_4, master_use_gtid=current_pos, ignore_server_ids=(12,13);
48 --enable_query_log
49 start slave;
50 --source include/wait_for_slave_to_start.inc
51 select @@gtid_binlog_state;
52 select @@gtid_slave_pos;
53 #--query_vertical SHOW SLAVE STATUS;
54
55 --connection node_4
56 --echo --- ignore_server_ids=(22,23)
57 --disable_query_log
58 --eval change master to master_host='127.0.0.1', master_user='root', MASTER_SSL_VERIFY_SERVER_CERT=0, master_port=$NODE_MYPORT_1, master_use_gtid=current_pos, ignore_server_ids=(22,23);
59 --enable_query_log
60 start slave;
61 --source include/wait_for_slave_to_start.inc
62 select @@gtid_binlog_state;
63 select @@gtid_slave_pos;
64 #--query_vertical SHOW SLAVE STATUS;
65
66 --echo cluster 1 node 1
67 --connection node_1
68 create table t1 (cluster_domain_id int ,node_server_id int, seq_no int);
69 insert into t1 values (1, 11, 2);
70 select @@gtid_binlog_state;
71
72 --echo #wait for sync cluster 1 and 2
73 --connection node_1
74 --source include/save_master_gtid.inc
75 --connection node_4
76 --source include/sync_with_master_gtid.inc
77
78 --echo cluster 2 node 1
79 --connection node_4
80 --let $wait_condition = SELECT COUNT(*) = 1 FROM test.t1;
81 --source include/wait_condition.inc
82 select @@gtid_binlog_state;
83 insert into t1 values (2, 21, 1);
84 select @@gtid_binlog_state;
85 --echo #wait for sync cluster 1 and 2
86 --connection node_1
87 --source include/save_master_gtid.inc
88 --connection node_4
89 --source include/sync_with_master_gtid.inc
90 --let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1;
91 --source include/wait_condition.inc
92 select * from t1 order by 1, 2, 3;
93
94
95 --echo cluster 1 node 2
96 --connection node_2
97 --let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1;
98 --source include/wait_condition.inc
99
100 select @@gtid_binlog_state;
101 insert into t1 values (1, 12, 3);
102 select @@gtid_binlog_state;
103
104 --echo #wait for sync cluster 1 and 2
105 --connection node_1
106 --source include/save_master_gtid.inc
107 --connection node_4
108 --source include/sync_with_master_gtid.inc
109 --let $wait_condition = SELECT COUNT(*) = 3 FROM test.t1;
110 --source include/wait_condition.inc
111 select * from t1 order by 1, 2, 3;
112
113 --echo cluster 1 node 3
114 --connection node_3
115 --let $wait_condition = SELECT COUNT(*) = 3 FROM test.t1;
116 --source include/wait_condition.inc
117 select @@gtid_binlog_state;
118 insert into t1 values (1, 13, 4);
119 select @@gtid_binlog_state;
120
121 --echo #wait for sync cluster 1 and 2
122 --connection node_1
123 --source include/save_master_gtid.inc
124 --connection node_4
125 --source include/sync_with_master_gtid.inc
126 --let $wait_condition = SELECT COUNT(*) = 4 FROM test.t1;
127 --source include/wait_condition.inc
128 select * from t1 order by 1, 2, 3;
129
130 --echo cluster 2 node 2
131 --connection node_5
132 --let $wait_condition = SELECT COUNT(*) = 4 FROM test.t1;
133 --source include/wait_condition.inc
134 select @@gtid_binlog_state;
135 insert into t1 values (2, 22, 2);
136 select @@gtid_binlog_state;
137
138 --echo #wait for sync cluster 2 and 1
139 --connection node_4
140 --source include/save_master_gtid.inc
141 --connection node_1
142 --source include/sync_with_master_gtid.inc
143 --let $wait_condition = SELECT COUNT(*) = 5 FROM test.t1;
144 --source include/wait_condition.inc
145 select * from t1 order by 1, 2, 3;
146
147 --echo cluster 2 node 3
148 --connection node_6
149 --let $wait_condition = SELECT COUNT(*) = 5 FROM test.t1;
150 --source include/wait_condition.inc
151 select @@gtid_binlog_state;
152 insert into t1 values (2, 23, 3);
153 select @@gtid_binlog_state;
154
155 --echo #wait for sync cluster 2 and 1
156 --connection node_4
157 --let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
158 --source include/wait_condition.inc
159 --source include/save_master_gtid.inc
160 --connection node_1
161 --source include/sync_with_master_gtid.inc
162 --let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
163 --source include/wait_condition.inc
164 select * from t1 order by 1, 2, 3;
165
166 --echo # check other nodes are consistent
167 --connection node_2
168 --let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
169 --source include/wait_condition.inc
170 select @@gtid_binlog_state;
171 select * from t1 order by 1, 2, 3;
172 --connection node_3
173 --let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
174 --source include/wait_condition.inc
175 select @@gtid_binlog_state;
176 select * from t1 order by 1, 2, 3;
177 --connection node_5
178 --let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
179 --source include/wait_condition.inc
180 select @@gtid_binlog_state;
181 select * from t1 order by 1, 2, 3;
182 --connection node_6
183 --let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
184 --source include/wait_condition.inc
185 select @@gtid_binlog_state;
186 select * from t1 order by 1, 2, 3;
187
188 --echo cluster 1 node 1
189 --connection node_1
190 --let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
191 --source include/wait_condition.inc
192 select @@gtid_binlog_state;
193 drop table t1;
194 stop slave;
195 reset slave;
196
197 --echo cluster 2 node 1
198 --connection node_4
199 stop slave;
200 reset slave;
201
202 --echo cluster 1 node 1
203 --connection node_1
204 change master to master_use_gtid=no, ignore_server_ids=();
205 set global wsrep_on=OFF;
206 reset master;
207 set global wsrep_on=ON;
208 set global GTID_SLAVE_POS="";
209 --sleep 2
210
211 --echo cluster 2 node 1
212 --connection node_4
213 change master to master_use_gtid=no, ignore_server_ids=();
214 set global wsrep_on=OFF;
215 reset master;
216 set global wsrep_on=ON;
217 set global GTID_SLAVE_POS="";
218
219 --connection node_2
220 set global wsrep_on=OFF;
221 reset master;
222 set global wsrep_on=ON;
223 --connection node_3
224 set global wsrep_on=OFF;
225 reset master;
226 set global wsrep_on=ON;
227 --connection node_5
228 set global wsrep_on=OFF;
229 reset master;
230 set global wsrep_on=ON;
231 --connection node_6
232 set global wsrep_on=OFF;
233 reset master;
234 set global wsrep_on=ON;
235 #--enable_parsing
236 #
237 # This test creates 2x 3 nodes galera cluster.
238 # The whole test case
239 # A <-> B <-> C {Galera cluster 1}
240 # \ /
241 # \ /
242 # / {C->D, F->A , Async normal slave repl}
243 # / \
244 # | \
245 # D <-> E <-> F {Galera cluster 2}
246 # We will write on any random node to see if gtid is consitent or not
247 # Then we will kill node D and set up the replication between A and E
248 # To see whether fail over works or not.
249 --connection node_1
250 --echo --- ignore_server_ids=(12,13)
251 --disable_query_log
252 --eval change master to master_host='127.0.0.1', master_user='root', MASTER_SSL_VERIFY_SERVER_CERT=0, master_port=$NODE_MYPORT_6, master_use_gtid=current_pos, ignore_server_ids=(12,13);
253 --enable_query_log
254 start slave;
255 --source include/wait_for_slave_to_start.inc
256 select @@gtid_binlog_state;
257 select @@gtid_slave_pos;
258 #--query_vertical SHOW SLAVE STATUS;
259
260 --connection node_4
261 --echo --- ignore_server_ids=(22,23)
262 --disable_query_log
263 --eval change master to master_host='127.0.0.1', master_user='root', MASTER_SSL_VERIFY_SERVER_CERT=0, master_port=$NODE_MYPORT_3, master_use_gtid=current_pos, ignore_server_ids=(22,23);
264 --enable_query_log
265 start slave;
266 --source include/wait_for_slave_to_start.inc
267 select @@gtid_binlog_state;
268 select @@gtid_slave_pos;
269 #--query_vertical SHOW SLAVE STATUS;
270
271 --echo cluster 1 node 1
272 --connection node_1
273 create table t1 (cluster_domain_id int ,node_server_id int, seq_no int);
274 insert into t1 values (1, 11, 2);
275
276 select @@gtid_binlog_state;
277
278 --echo #wait for sync cluster 1 and 2
279 --connection node_1
280 --source include/save_master_gtid.inc
281 --connection node_4
282 --source include/sync_with_master_gtid.inc
283 --sleep 2
284 --echo cluster 2 node 1
285 --connection node_4
286 --let $wait_condition = SELECT COUNT(*) = 1 FROM test.t1;
287 --source include/wait_condition.inc
288 insert into t1 values (2, 21, 1);
289 select @@gtid_binlog_state;
290
291 --echo #wait for sync cluster 1 and 2
292 --connection node_1
293 --source include/save_master_gtid.inc
294 --connection node_4
295 --source include/sync_with_master_gtid.inc
296 --let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1;
297 --source include/wait_condition.inc
298
299 select * from t1 order by 1, 2, 3;
300
301
302 --echo cluster 1 node 2
303 --connection node_2
304 --let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1;
305 --source include/wait_condition.inc
306 select @@gtid_binlog_state;
307 insert into t1 values (1, 12, 3);
308 select @@gtid_binlog_state;
309
310 --echo #wait for sync cluster 1 and 2
311 --connection node_1
312 --source include/save_master_gtid.inc
313 --connection node_4
314 --source include/sync_with_master_gtid.inc
315 --let $wait_condition = SELECT COUNT(*) = 3 FROM test.t1;
316 --source include/wait_condition.inc
317 select * from t1 order by 1, 2, 3;
318
319 --echo cluster 1 node 3
320 --connection node_3
321 --let $wait_condition = SELECT COUNT(*) = 3 FROM test.t1;
322 --source include/wait_condition.inc
323 select @@gtid_binlog_state;
324 insert into t1 values (1, 13, 4);
325 select @@gtid_binlog_state;
326
327 --echo #wait for sync cluster 1 and 2
328 --connection node_1
329 --source include/save_master_gtid.inc
330 --connection node_4
331 --source include/sync_with_master_gtid.inc
332 --let $wait_condition = SELECT COUNT(*) = 4 FROM test.t1;
333 --source include/wait_condition.inc
334 select * from t1 order by 1, 2, 3;
335
336 --echo cluster 2 node 2
337 --connection node_5
338 --let $wait_condition = SELECT COUNT(*) = 4 FROM test.t1;
339 --source include/wait_condition.inc
340 select @@gtid_binlog_state;
341 insert into t1 values (2, 22, 2);
342 select @@gtid_binlog_state;
343
344 --echo #wait for sync cluster 2 and 1
345 --connection node_4
346 --source include/save_master_gtid.inc
347 --connection node_1
348 --source include/sync_with_master_gtid.inc
349 --let $wait_condition = SELECT COUNT(*) = 5 FROM test.t1;
350 --source include/wait_condition.inc
351 select * from t1 order by 1, 2, 3;
352
353 --echo cluster 2 node 3
354 --connection node_6
355 --let $wait_condition = SELECT COUNT(*) = 5 FROM test.t1;
356 --source include/wait_condition.inc
357 select @@gtid_binlog_state;
358 insert into t1 values (2, 23, 3);
359 select @@gtid_binlog_state;
360
361 --echo #wait for sync cluster 2 and 1
362 --connection node_4
363 --source include/save_master_gtid.inc
364 --connection node_1
365 --source include/sync_with_master_gtid.inc
366 --let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
367 --source include/wait_condition.inc
368 select * from t1 order by 1, 2, 3;
369
370 --echo # check other nodes are consistent
371 --connection node_2
372 --let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
373 --source include/wait_condition.inc
374 select @@gtid_binlog_state;
375 select * from t1 order by 1, 2, 3;
376 --connection node_3
377 --let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
378 --source include/wait_condition.inc
379 select @@gtid_binlog_state;
380 select * from t1 order by 1, 2, 3;
381 --connection node_5
382 --let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
383 --source include/wait_condition.inc
384 select @@gtid_binlog_state;
385 select * from t1 order by 1, 2, 3;
386 --connection node_6
387 --let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
388 --source include/wait_condition.inc
389 select @@gtid_binlog_state;
390 select * from t1 order by 1, 2, 3;
391
392 --echo cluster 1 node 1
393 --connection node_1
394 --let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
395 --source include/wait_condition.inc
396 select @@gtid_binlog_state;
397 drop table t1;
398 stop slave;
399 change master to master_use_gtid=no, ignore_server_ids=();
400 set global wsrep_on=OFF;
401 reset master;
402 set global wsrep_on=ON;
403 set global GTID_SLAVE_POS="";
404
405 --echo cluster 2 node 1
406 --connection node_4
407 stop slave;
408 change master to master_use_gtid=no, ignore_server_ids=();
409 set global wsrep_on=OFF;
410 reset master;
411 set global wsrep_on=ON;
412 set global GTID_SLAVE_POS="";
413
414 --connection node_2
415 set global wsrep_on=OFF;
416 reset master;
417 set global wsrep_on=ON;
418 --connection node_3
419 set global wsrep_on=OFF;
420 reset master;
421 set global wsrep_on=ON;
422 --connection node_5
423 set global wsrep_on=OFF;
424 reset master;
425 set global wsrep_on=ON;
426 --connection node_6
427 set global wsrep_on=OFF;
428 reset master;
429 set global wsrep_on=ON;