Debian Codegraph @

mysql-test/suite/rpl_gtid/t/rpl_check_gtid.test

raw
1 #Want to skip this test from daily Valgrind execution
2 --source include/no_valgrind_without_big.inc
3 --source include/not_group_replication_plugin.inc
4 # Adding big test option for this test.
5 --source include/big_test.inc
6 --source include/have_debug_sync.inc
7
8 ################################################################################
9 # This test case checks if a set of properties related to the GTIDs hold
10 # after rotating the binary/relay logs and after crashes. The properties
11 # are as follows:
12 #
13 # 1. Guarantee that an event generated on the master appears everywhere.
14 #
15 # Property 1.1 The set of GTIDs generated on the master are unique and
16 # monotonically created.
17 #
18 # Property 1.2 The set of GTIDs generated on the master are preserved
19 # in the relay log after being fetched.
20 #
21 # Property 1.2 The set of GTIDs generated on the master are preserved
22 # in the slave's binary log after execution.
23 #
24 # 2. Guarantee that the Previous GTIDs events are correctly stored everywhere.
25 #
26 # Property 2.1 - The Previous GTIDs stored in a binary log must represent the
27 # set of transactions stored in the previous binary logs.
28 #
29 # Property 2.2 - The Previous GTIDs stored in a relay log must represent the
30 # set of complete transactions stored in the previous relay
31 # logs.
32 #
33 # 3. Guarantee that RESET SLAVE/RESET MASTER cleans the appropriate states.
34 #
35 # Property 3.1 - RESET SLAVE cleans the GTIDs and previous GTIDs' state
36 # stored in the relay log.
37 #
38 # Property 3.2 - RESET MASTER cleans the GTIDs and previous GTIDs' state
39 # stored in the binary log.
40 #
41 # 4. With CHANGE MASTER TO MASTER_AUTO_POSITION coordinates are not used.
42 #
43 # Property 4.1 - When MASTER_AUTO_POSITION is specified only missing data
44 # transactions on the slave are retrieved from the master.
45 #
46 # We check if the aforementioned properties hold after generating a set
47 # of transactions and rotating logs through different methods:
48 #
49 # 1. On both master and slave, rotate logs through FLUSH LOGS.
50 # 2. On the slave, generate spreaded events by rotating the relay log using
51 # FLUSH RELAY LOGS when the IO thread is in the middle of a transaction.
52 # On the master, rotate logs through FLUSH LOGS.
53 # 3. On the slave, rotate logs by restarting the server. On the master,
54 # rotate logs through FLUSH LOGS.
55 # 4. On the slave, rotate logs by start/stop. On the master, rotate logs by
56 # restarting the server.
57 # 5. RESET SLAVE must not affect its binary log. On the master, rotate logs
58 # by restarting the server.
59 # 6. On the slave, rotate logs by start/stop and calling CHANGE MASTER TO
60 # with MASTER_AUTO_POSITION enabled. On the master, rotate logs through
61 # FLUSH LOGS.
62 # 7. On the slave, rotate logs by start/stop and calling START SLAVE UNTIL
63 # GTID. On the master, rotate logs through FLUSH LOGS.
64 #
65 # We also check if the aforementioned properties hold after crashes:
66 #
67 # 8. Binary logs without Previous GTIDs are generated simulating a crash
68 # right after the file is created.
69 #
70 # 9. Binary logs with corrupted GTIDs are generated simulating a crash
71 # while writing such information into the binary log.
72 ################################################################################
73 --source include/not_windows.inc
74 --source include/have_debug.inc
75 --source include/master-slave.inc
76
77 # this test case requires that certain events appear in a given
78 # order in the relay log. With compression, only GTID and a
79 # Transaction_payload event shall appear, which makes this test
80 # case invalid in that scenario.
81 --source include/not_binlog_transaction_compression_on.inc
82
83 --disable_warnings
84 call mtr.add_suppression("Recovery from source pos .*");
85 call mtr.add_suppression("Error in Log_event::read_log_event()");
86 call mtr.add_suppression("Failed to read information on Previous GTIDs.");
87 call mtr.add_suppression("Error reading GTIDs from binary log");
88 --enable_warnings
89
90 CREATE TABLE t1(id INTEGER) ENGINE= Innodb;
91
92 --let $master_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
93 --connection slave
94 --let $replica_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
95
96
97 #
98 # 1. This part of the test case:
99 #
100 # 1.1 - Generates a set of transactions on the master.
101 #
102 # 1.2 - Makes the slave to retrieve and apply these transactions.
103 #
104 # 1.3 - Rotates both the binary logs on the slave and master
105 # by calling FLUSH LOGS.
106 #
107
108 --echo ==== Part 1 ====
109
110 --disable_warnings
111 --source include/rpl_reset.inc
112 --enable_warnings
113
114 --let $i=1
115 while ($i != 5)
116 {
117 --echo ---- i=$i ----
118
119 # 1.1 - Generates a set of transactions on the master.
120 --connection master
121 BEGIN;
122 INSERT INTO t1 VALUES(1);
123 INSERT INTO t1 VALUES(2);
124 COMMIT;
125
126 # Check property 1.1 and 2.1.
127 --let $binlog= binlog
128 --let $server_uuid= $master_uuid
129 if ($i == 1)
130 {
131 --let $gtid_set_ini= 0
132 --let $gtid_set_end= 0
133 --let $gtid_ini= `SELECT $i`
134 --let $gtid_end= `SELECT $i`
135 }
136 if ($i != 1)
137 {
138 --let $gtid_set_ini= 1
139 --let $gtid_set_end= `SELECT $i - 1`
140 --let $gtid_ini= `SELECT $i`
141 --let $gtid_end= `SELECT $i`
142 }
143 --source extra/rpl_tests/rpl_check_gtid.inc
144
145 # 1.2 - Makes the slave to retrieve and apply these transactions.
146 --source include/sync_slave_sql_with_master.inc
147 --connection slave
148
149 # Check property 1.2 and 2.1.
150 --let $binlog= binlog
151 --let $server_uuid= $master_uuid
152 if ($i == 1)
153 {
154 --let $gtid_set_ini= 0
155 --let $gtid_set_end= 0
156 --let $gtid_ini= `SELECT $i`
157 --let $gtid_end= `SELECT $i`
158 }
159 if ($i != 1)
160 {
161 --let $gtid_set_ini= 1
162 --let $gtid_set_end= `SELECT $i - 1`
163 --let $gtid_ini= `SELECT $i`
164 --let $gtid_end= `SELECT $i`
165 }
166 --source extra/rpl_tests/rpl_check_gtid.inc
167
168 # Check property 1.3 and 2.2.
169 --let $binlog= relaylog
170 --let $server_uuid= $master_uuid
171 if ($i == 1)
172 {
173 --let $gtid_set_ini= 0
174 --let $gtid_set_end= 0
175 --let $gtid_ini= `SELECT $i`
176 --let $gtid_end= `SELECT $i`
177 }
178 if ($i != 1)
179 {
180 --let $gtid_set_ini= 1
181 --let $gtid_set_end= `SELECT $i - 1`
182 --let $gtid_ini= `SELECT $i`
183 --let $gtid_end= `SELECT $i`
184 }
185 --source extra/rpl_tests/rpl_check_gtid.inc
186
187 BEGIN;
188 INSERT INTO t1 VALUES(1);
189 INSERT INTO t1 VALUES(2);
190 COMMIT;
191
192 # Check property 1.1 and 2.1.
193 --let $binlog= binlog
194 --let $server_uuid= $replica_uuid
195 if ($i == 1)
196 {
197 --let $gtid_set_ini= 0
198 --let $gtid_set_end= 0
199 --let $gtid_ini= `SELECT $i`
200 --let $gtid_end= `SELECT $i`
201 }
202 if ($i != 1)
203 {
204 --let $gtid_set_ini= 1
205 --let $gtid_set_end= `SELECT $i - 1`
206 --let $gtid_ini= `SELECT $i`
207 --let $gtid_end= `SELECT $i`
208 }
209 --source extra/rpl_tests/rpl_check_gtid.inc
210
211 # 1.3 - Rotates both the binary logs on the slave and master.
212 FLUSH LOGS;
213 --connection master
214 FLUSH LOGS;
215
216 inc $i;
217 }
218
219 #
220 # 2. This part of the test case:
221 #
222 # 2.1 - Generates a set of transactions on the master.
223 #
224 # 2.2 - Makes the slave to retrieve these transactions and
225 # spread their events into two relay logs. Then apply
226 # the events.
227 #
228 # 2.3 - Rotates the binary log on the master
229 # by calling FLUSH LOGS.
230 #
231
232 --echo ==== Part 2 ====
233
234 # This test was designed to sync slave with the master using positions
235 # instead of GTIDs. However, if the test is ran with GTID_MODE=ON it
236 # uses GTIDs to sync the slave with the master.
237 # When MTS is enabled, the slave may have the GITDs of transactions
238 # in the GTID_EXECUTED before updating slave's applier position, and
239 # this situation may lead to fail in this part of the test.
240 # So, it is better to ignore GTIDs on sync.
241 --let $ignore_gtids_on_sync= 1
242
243 --disable_warnings
244 --source include/rpl_reset.inc
245 --enable_warnings
246 --connection slave
247 --source include/stop_slave.inc
248 --disable_warnings
249 --source include/start_slave.inc
250 --enable_warnings
251
252 --connection master
253 # This transaction will be the MASTER_UUID:1
254 BEGIN;
255 INSERT INTO t1 VALUES(0);
256 COMMIT;
257 --source include/sync_slave_sql_with_master.inc
258
259 --let $i=1
260 while ($i != 5)
261 {
262 --echo ---- i=$i ----
263 --source include/rpl_connection_slave.inc
264 --let $debug_point= pause_on_queuing_event
265 --source include/add_debug_point.inc
266
267 # 2.1 - Generates a set of transactions on the master.
268 # Each transaction will have more than three events
269 # depending on binlog format:
270 #
271 # GTID + QUERY(BEGIN) + QUERY(INSERT) + QUERY(INSERT) + XID
272 # or
273 # GTID + QUERY(BEGIN) + TABLE_MAP + ROWS + XID
274 #
275 # So, this part of the test will issue an "FLUSH LOCAL RELAY LOGS"
276 # on the slave right before queuing the fourth event of the
277 # transaction.
278 --source include/rpl_connection_master.inc
279 BEGIN;
280 INSERT INTO t1 VALUES(1);
281 INSERT INTO t1 VALUES(2);
282 COMMIT;
283
284 --let $event_counter= 3
285 --source include/rpl_connection_slave.inc
286 while ($event_counter > 0)
287 {
288 --echo Waiting for $event_counter more event(s) before flushing relaylog
289 # Wait for the IO thread to reach the beginning of queue_event.
290 SET DEBUG_SYNC='now WAIT_FOR reached_queuing_event';
291 # Let IO thread continue its work
292 SET DEBUG_SYNC= 'now SIGNAL continue_queuing_event';
293 --dec $event_counter
294 }
295 # Make the IO thread to create a new relaylog file while in the middle
296 # of a transaction.
297 FLUSH LOCAL RELAY LOGS;
298 # Wait for the IO thread to reach the beginning of queue_event.
299 SET DEBUG_SYNC='now WAIT_FOR reached_queuing_event';
300 # Make sure the test will not stop again in the beginning of queue_event.
301 --source include/remove_debug_point.inc
302 # Let IO thread continue its work
303 SET DEBUG_SYNC= 'now SIGNAL continue_queuing_event';
304
305 # 2.2 - Makes the slave to retrieve these transactions and
306 # spread their events into two relay logs. Then apply
307 # the events.
308 --source include/rpl_connection_master.inc
309 --source include/sync_slave_sql_with_master.inc
310
311 # Check property 2.2.
312 --let $binlog= relaylog
313 --let $server_uuid= $master_uuid
314 --let $gtid_set_ini= 1
315 --let $gtid_set_end= `SELECT $i`
316 --let $gtid_ini=
317 --let $gtid_end=
318 --source extra/rpl_tests/rpl_check_gtid.inc
319
320 # 2.3 - Rotates the binary log on the master.
321 --connection master
322 FLUSH LOGS;
323
324 inc $i;
325 }
326
327 --let $ignore_gtids_on_sync= 0
328
329 #
330 # 3. This part of the test case:
331 #
332 # 3.1 - Generates a set of transactions on the master.
333 #
334 # 3.2 - Makes the slave to retrieve and apply these transactions
335 #
336 # 3.3 - Restarts the slave server to rotate binary and relay logs.
337 #
338 # 3.4 - Rotates both the binary logs on the slave and master
339 # by calling FLUSH LOGS.
340 #
341
342 --echo ==== Part 3 ====
343
344 --connection slave
345 --disable_warnings
346 --source include/rpl_reset.inc
347 --enable_warnings
348
349 --source include/stop_slave.inc
350 SET GLOBAL debug="";
351 --disable_warnings
352 --source include/start_slave.inc
353 --enable_warnings
354
355 --let $i=1
356 while ($i != 5)
357 {
358 --echo ---- i=$i ----
359
360 # 3.1 - Generates a set of transactions on the master.
361 --connection master
362 BEGIN;
363 INSERT INTO t1 VALUES(1);
364 INSERT INTO t1 VALUES(2);
365 COMMIT;
366
367 # 3.2 - Makes the slave to retrieve and apply these transactions.
368 --source include/sync_slave_sql_with_master.inc
369
370 # Check property 1.2 and 2.1.
371 --connection slave
372 --let $binlog= binlog
373 --let $server_uuid= $master_uuid
374 if ($i == 1)
375 {
376 --let $gtid_set_ini= 0
377 --let $gtid_set_end= 0
378 --let $gtid_ini= 1
379 --let $gtid_end= 1
380 }
381 if ($i != 1)
382 {
383 --let $gtid_set_ini= 1
384 --let $gtid_set_end= `SELECT $i - 1`
385 --let $gtid_ini= `SELECT $i`
386 --let $gtid_end= `SELECT $i`
387 }
388 --source extra/rpl_tests/rpl_check_gtid.inc
389
390 # Check property 1.3 and 2.2.
391 --let $binlog= relaylog
392 --let $server_uuid= $master_uuid
393 if ($i == 1)
394 {
395 --let $gtid_set_ini= 0
396 --let $gtid_set_end= 0
397 --let $gtid_ini= 1
398 --let $gtid_end= 1
399 }
400 if ($i != 1)
401 {
402 --let $gtid_set_ini= 1
403 --let $gtid_set_end= `SELECT $i - 1`
404 --let $gtid_ini= `SELECT $i`
405 --let $gtid_end= `SELECT $i`
406 }
407 --source extra/rpl_tests/rpl_check_gtid.inc
408
409 # 3.3 - Restarts the slave server to rotate binary and relay logs.
410 --source include/stop_slave.inc
411 --let $rpl_server_number= 2
412 --source include/rpl_restart_server.inc
413 --connection slave
414 --disable_warnings
415 --source include/start_slave.inc
416 --enable_warnings
417
418 # 3.4 - Rotates both the binary logs on the slave and master.
419 FLUSH LOGS;
420 --connection master
421 FLUSH LOGS;
422
423 inc $i;
424 }
425
426 #
427 # 4. This part of the test case:
428 #
429 # 4.1 - Generates a set of transactions on the master.
430 #
431 # 4.2 - Makes the slave to retrieve and apply these transactions
432 #
433 # 4.3 - Stops the slave, restart the master server and starts the
434 # slave to rotate both slave and master's binary and slave's
435 # relay logs.
436 #
437 # 4.4 - Rotates both the binary logs on the slave and master
438 # by calling FLUSH LOGS.
439 #
440
441 --echo ==== Part 4 ====
442
443 --disable_warnings
444 --source include/rpl_reset.inc
445 --enable_warnings
446
447 --let $i=1
448 while ($i != 5)
449 {
450 --echo ---- i=$i ----
451
452 # 4.1 - Generates a set of transactions on the master.
453 --connection master
454 BEGIN;
455 INSERT INTO t1 VALUES(1);
456 INSERT INTO t1 VALUES(2);
457 COMMIT;
458
459 # Check property 1.1 and 2.1.
460 --let $binlog= binlog
461 --let $server_uuid= $master_uuid
462 if ($i == 1)
463 {
464 --let $gtid_set_ini= 0
465 --let $gtid_set_end= 0
466 --let $gtid_ini= 1
467 --let $gtid_end= 1
468 }
469 if ($i != 1)
470 {
471 --let $gtid_set_ini= 1
472 --let $gtid_set_end= `SELECT $i - 1`
473 --let $gtid_ini= `SELECT $i`
474 --let $gtid_end= `SELECT $i`
475 }
476 --source extra/rpl_tests/rpl_check_gtid.inc
477
478 # 4.2 - Makes the slave to retrieve and apply these transactions.
479 --source include/sync_slave_sql_with_master.inc
480
481 # Check property 1.2 and 2.1.
482 --connection slave
483 --let $binlog= binlog
484 --let $server_uuid= $master_uuid
485 if ($i == 1)
486 {
487 --let $gtid_set_ini= 0
488 --let $gtid_set_end= 0
489 --let $gtid_ini= 1
490 --let $gtid_end= 1
491 }
492 if ($i != 1)
493 {
494 --let $gtid_set_ini= 1
495 --let $gtid_set_end= `SELECT $i - 1`
496 --let $gtid_ini= `SELECT $i`
497 --let $gtid_end= `SELECT $i`
498 }
499 --source extra/rpl_tests/rpl_check_gtid.inc
500
501 # Check property 1.3 and 2.2.
502 --let $binlog= relaylog
503 --let $server_uuid= $master_uuid
504 if ($i == 1)
505 {
506 --let $gtid_set_ini= 0
507 --let $gtid_set_end= 0
508 --let $gtid_ini= 1
509 --let $gtid_end= 1
510 }
511 if ($i != 1)
512 {
513 --let $gtid_set_ini= 1
514 --let $gtid_set_end= `SELECT $i - 1`
515 --let $gtid_ini= `SELECT $i`
516 --let $gtid_end= `SELECT $i`
517 }
518 --source extra/rpl_tests/rpl_check_gtid.inc
519
520 # 4.3 - Stops the slave, restart the master server and starts the
521 # slave.
522 --source include/stop_slave.inc
523 --connection master
524 --let $rpl_server_number= 1
525 --source include/rpl_restart_server.inc
526 --connection slave
527 --disable_warnings
528 --source include/start_slave.inc
529 --enable_warnings
530
531 # 4.4 - Rotates both the binary logs on the slave and master.
532 FLUSH LOGS;
533 --connection master
534 FLUSH LOGS;
535
536 inc $i;
537 }
538
539 #
540 # 5. This part of the test case:
541 #
542 # 5.1 - Resets the IO Thread's state but not SQL Thread's state.
543 #
544 # 5.2 - Generates a set of transactions on the master.
545 #
546 # 5.3 - Stops the slave, restart the master server and starts the
547 # slave to rotate both slave and master's binary and slave's
548 # relay logs.
549 #
550 # 5.4 - Rotates both the binary logs on the slave and master
551 # by calling FLUSH LOGS.
552 #
553
554 --echo ==== Part 5 ====
555
556 --let $i=1
557 while ($i != 5)
558 {
559 --echo ---- i=$i ----
560
561 # 5.1 - Resets the IO Thread's state but not SQL Thread's state.
562 --connection slave
563 --source include/stop_slave.inc
564 RESET SLAVE;
565 RESET MASTER;
566 --connection master
567 RESET MASTER;
568 --connection slave
569 --disable_warnings
570 --source include/start_slave.inc
571 --enable_warnings
572
573 # 5.2 - Generates a set of transactions on the master.
574 --connection master
575 BEGIN;
576 INSERT INTO t1 VALUES(1);
577 INSERT INTO t1 VALUES(2);
578 COMMIT;
579
580 BEGIN;
581 INSERT INTO t1 VALUES(1);
582 INSERT INTO t1 VALUES(2);
583 COMMIT;
584
585 # 5.3 - Makes the slave to retrieve and apply these transactions.
586 --source include/sync_slave_sql_with_master.inc
587 # Check property 1.2, 2.1, 3.1 and 3.2
588 --let $binlog= binlog
589 --let $server_uuid= $master_uuid
590 --let $gtid_set_ini=
591 --let $gtid_set_end=
592 --let $gtid_ini= 1
593 --let $gtid_end= 2
594 --source extra/rpl_tests/rpl_check_gtid.inc
595
596 # 5.4 - Rotates both the binary logs on the slave and master.
597 FLUSH LOGS;
598 --connection master
599 FLUSH LOGS;
600
601 inc $i;
602 }
603
604 #
605 # 6. This part of the test case:
606 #
607 # 6.1 - Generates a set of transactions on the master.
608 #
609 # 6.2 - Makes the slave to retrieve and apply these transactions through
610 # sync_slave_gtids_with_master
611 #
612 # 6.3 - Stop the slave, call CHANGE MASTER TO with MASTER_AUTO_POSITION and
613 # start the slave to rotate the relay log.
614 #
615 # 6.4 - Rotates the binary log on master by calling FLUSH LOGS.
616 #
617
618 --echo ==== Part 6 ====
619
620 --connection slave
621 --source include/stop_slave.inc
622 RESET SLAVE;
623 RESET MASTER;
624 --connection master
625 RESET MASTER;
626 --connection slave
627 --let $slave_master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1)
628 --error ER_BAD_REPLICA_AUTO_POSITION
629 CHANGE REPLICATION SOURCE TO SOURCE_AUTO_POSITION= 1, SOURCE_LOG_FILE= 'master-bin.000001', SOURCE_LOG_POS= 4;
630 --disable_warnings
631 --source include/start_slave.inc
632 --enable_warnings
633
634 --let $replica_uuid= `SELECT @@GLOBAL.SERVER_UUID`
635 --connection master
636 --let $master_uuid= `SELECT @@GLOBAL.SERVER_UUID`
637
638 --let $i=1
639 while ($i != 5)
640 {
641 --echo ---- i=$i ----
642
643 # 6.1 - Generates a set of transactions on the master.
644 --connection master
645 BEGIN;
646 INSERT INTO t1 VALUES(1);
647 INSERT INTO t1 VALUES(2);
648 COMMIT;
649
650 --let $wait_gtids_first= query_get_value(SHOW MASTER STATUS, Executed_Gtid_Set, 1)
651
652 BEGIN;
653 INSERT INTO t1 VALUES(1);
654 INSERT INTO t1 VALUES(2);
655 COMMIT;
656
657 --let $wait_gtids_second= query_get_value(SHOW MASTER STATUS, Executed_Gtid_Set, 1)
658
659 if (`SELECT ($i % 2) = 0`)
660 {
661 --connection slave
662 --replace_result $master_uuid MASTER_UUID $replica_uuid SLAVE_UUID
663 --disable_result_log
664 --eval SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('$wait_gtids_first', 300)
665 --enable_result_log
666 --replace_result $master_uuid MASTER_UUID $replica_uuid SLAVE_UUID
667 --disable_result_log
668 --eval SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('$wait_gtids_second', 300)
669 --enable_result_log
670 }
671
672 if (`SELECT ($i % 2) = 1`)
673 {
674 --connection slave
675 --replace_result $master_uuid MASTER_UUID $replica_uuid SLAVE_UUID
676 --disable_result_log
677 --eval SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('$wait_gtids_first')
678 --enable_result_log
679 --replace_result $master_uuid MASTER_UUID $replica_uuid SLAVE_UUID
680 --disable_result_log
681 --eval SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('$wait_gtids_second')
682 --enable_result_log
683 }
684
685 # Check property 4.1
686 --let $binlog= relaylog
687 --let $server_uuid= $master_uuid
688 --let $gtid_set_ini=
689 --let $gtid_set_end=
690 --let $gtid_ini= `SELECT ($i * 2) - 1`
691 --let $gtid_end= `SELECT $i * 2`
692 --source extra/rpl_tests/rpl_check_gtid.inc
693
694 # 6.3 - Stop and start the slave, call CHANGE MASTER TO with MASTER_AUTO_POSITION.
695 --source include/stop_slave.inc
696 --replace_result $slave_master_host SLAVE_MASTER_HOST
697 --eval CHANGE REPLICATION SOURCE TO SOURCE_HOST= '$slave_master_host', SOURCE_AUTO_POSITION= 1
698 --disable_warnings
699 --source include/start_slave.inc
700 --enable_warnings
701
702 # 6.4 - Rotates the binary log on master by calling FLUSH LOGS.
703 --connection master
704 FLUSH LOGS;
705
706 inc $i;
707 }
708
709 #
710 # 7. This part of the test case:
711 #
712 # 7.1 - Generates a set of transactions on the master.
713 #
714 # 7.2 - Makes the slave to retrieve and apply these transactions through
715 # START SLAVE UNTIL GTID.
716 #
717 # 7.3 - Rotates the binary log on master by calling FLUSH LOGS.
718 #
719
720 --echo ==== Part 7 ====
721
722 --connection slave
723 --source include/stop_slave.inc
724 RESET SLAVE;
725 RESET MASTER;
726 --connection master
727 RESET MASTER;
728 --connection slave
729 --let $slave_master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1)
730 --replace_result $slave_master_host SLAVE_MASTER_HOST
731 --eval CHANGE REPLICATION SOURCE TO SOURCE_HOST= '$slave_master_host', SOURCE_AUTO_POSITION= 1
732
733 --let $i=1
734 while ($i != 5)
735 {
736 --echo ---- i=$i ----
737
738 # 7.1 - Generates a set of transactions on the master.
739 --connection master
740 BEGIN;
741 INSERT INTO t1 VALUES(1);
742 INSERT INTO t1 VALUES(2);
743 COMMIT;
744
745 BEGIN;
746 INSERT INTO t1 VALUES(1);
747 INSERT INTO t1 VALUES(2);
748 COMMIT;
749
750 # 7.2 - Makes the slave to retrieve and apply these transactions.
751 --connection slave
752 --let $sequence= `SELECT ($i * 2)`
753 --replace_result $master_uuid MASTER_UUID
754 --disable_warnings
755 --eval START SLAVE UNTIL SQL_BEFORE_GTIDS= "$master_uuid:$sequence"
756 --enable_warnings
757 --source include/wait_for_slave_sql_to_stop.inc
758 --source include/stop_slave.inc
759
760 # Check property 1.2 and 4.1.
761 --let $binlog= binlog
762 --let $server_uuid= $master_uuid
763 --let $gtid_set_ini=
764 --let $gtid_set_end=
765 --let $gtid_ini= 1
766 --let $gtid_end= `SELECT ($i * 2) - 1`
767 --source extra/rpl_tests/rpl_check_gtid.inc
768
769 # 7.3 - Rotates the binary log on master by calling FLUSH LOGS.
770 --connection master
771 FLUSH LOGS;
772
773 inc $i;
774 }
775
776 #
777 # 8. This part of the test case:
778 #
779 # 8.1 - Generates a set of transactions on the master.
780 #
781 # 8.2 - Makes the slave to retrieve and apply these transactions
782 #
783 # 8.3 - Restarts the slave server to rotate binary and relay logs.
784 # However, binary logs without Previous Gtids are created.
785 #
786 # 8.4 - Rotates both the binary logs on the slave and master
787 # by calling FLUSH LOGS.
788 #
789
790 --echo ==== Part 8 ====
791
792 --connection slave
793 --source include/stop_slave.inc
794 RESET MASTER;
795 RESET SLAVE;
796 --eval CHANGE REPLICATION SOURCE TO SOURCE_HOST= '$slave_master_host', SOURCE_AUTO_POSITION= 0
797 --connection master
798 RESET MASTER;
799 --connection slave
800 --disable_warnings
801 --source include/start_slave.inc
802 --enable_warnings
803
804 --let $i=1
805 while ($i != 5)
806 {
807 --echo ---- i=$i ----
808
809 # 8.1 - Generates a set of transactions on the master.
810 --connection master
811 BEGIN;
812 INSERT INTO t1 VALUES(1);
813 INSERT INTO t1 VALUES(2);
814 COMMIT;
815
816 # 8.2 - Makes the slave to retrieve and apply these transactions.
817 --source include/sync_slave_sql_with_master.inc
818
819 # Check property 1.2 and 2.1.
820 --connection slave
821 --let $binlog= binlog
822 --let $server_uuid= $master_uuid
823 if ($i == 1)
824 {
825 --let $gtid_set_ini= 0
826 --let $gtid_set_end= 0
827 --let $gtid_ini= 1
828 --let $gtid_end= 1
829 }
830 if ($i != 1)
831 {
832 --let $gtid_set_ini= 1
833 --let $gtid_set_end= `SELECT $i - 1`
834 --let $gtid_ini= `SELECT $i`
835 --let $gtid_end= `SELECT $i`
836 }
837 --source extra/rpl_tests/rpl_check_gtid.inc
838
839 # Check property 1.3 and 2.2.
840 --let $binlog= relaylog
841 --let $server_uuid= $master_uuid
842 if ($i == 1)
843 {
844 --let $gtid_set_ini= 0
845 --let $gtid_set_end= 0
846 --let $gtid_ini= 1
847 --let $gtid_end= 1
848 }
849 # Post relay log recovery the previous GTIDs set should
850 # be empty.
851 if ($i != 1)
852 {
853 --let $gtid_set_ini= 0
854 --let $gtid_set_end= 0
855 --let $gtid_ini= `SELECT $i`
856 --let $gtid_end= `SELECT $i`
857 }
858 --source extra/rpl_tests/rpl_check_gtid.inc
859
860 # 8.3 - Restarts the slave server to rotate binary and relay logs.
861 --source include/stop_slave.inc
862
863 --let $rpl_server_number= 2
864 --let $rpl_server_parameters= --relay-log-recovery=1 --debug=d,skip_writing_previous_gtids_log_event
865 --source include/rpl_restart_server.inc
866 --let $rpl_server_number= 2
867 --let $rpl_server_parameters= --relay-log-recovery=1
868 --source include/rpl_restart_server.inc
869
870 --connection slave
871 --disable_warnings
872 --source include/start_slave.inc
873 --enable_warnings
874 # 8.4 - Rotates both the binary logs on the slave and master.
875 FLUSH LOGS;
876 --connection master
877 FLUSH LOGS;
878
879 inc $i;
880 }
881
882 #
883 # 9. This part of the test case:
884 #
885 # 9.1 - Generates a set of transactions on the master.
886 #
887 # 9.2 - Makes the slave to retrieve and apply these transactions
888 #
889 # 9.3 - Restarts the slave server to rotate binary and relay logs.
890 # However, binary logs with corrupted Previous Gtids are created.
891 #
892 # 9.4 - Rotates both the binary logs on the slave and master
893 # by calling FLUSH LOGS.
894 #
895
896 --echo ==== Part 9 ====
897
898 --disable_warnings
899 --source include/rpl_reset.inc
900 --enable_warnings
901
902 --let $i=1
903 while ($i != 5)
904 {
905 --echo ---- i=$i ----
906
907 # 9.1 - Generates a set of transactions on the master.
908 --connection master
909 BEGIN;
910 INSERT INTO t1 VALUES(1);
911 INSERT INTO t1 VALUES(2);
912 COMMIT;
913
914 # 9.2 - Makes the slave to retrieve and apply these transactions.
915 --source include/sync_slave_sql_with_master.inc
916
917 # Check property 1.2 and 2.1.
918 --connection slave
919 --let $binlog= binlog
920 --let $server_uuid= $master_uuid
921 if ($i == 1)
922 {
923 --let $gtid_set_ini= 0
924 --let $gtid_set_end= 0
925 --let $gtid_ini= 1
926 --let $gtid_end= 1
927 }
928 if ($i != 1)
929 {
930 --let $gtid_set_ini= 1
931 --let $gtid_set_end= `SELECT $i - 1`
932 --let $gtid_ini= `SELECT $i`
933 --let $gtid_end= `SELECT $i`
934 }
935 --source extra/rpl_tests/rpl_check_gtid.inc
936
937 # Check property 1.3 and 2.2.
938 --let $binlog= relaylog
939 --let $server_uuid= $master_uuid
940 if ($i == 1)
941 {
942 --let $gtid_set_ini= 0
943 --let $gtid_set_end= 0
944 --let $gtid_ini= 1
945 --let $gtid_end= 1
946 }
947 # Post relay log recovery the previous GTIDs set should
948 # be empty.
949 if ($i != 1)
950 {
951 --let $gtid_set_ini= 0
952 --let $gtid_set_end= 0
953 --let $gtid_ini= `SELECT $i`
954 --let $gtid_end= `SELECT $i`
955 }
956 --source extra/rpl_tests/rpl_check_gtid.inc
957
958 # 9.3 - Restarts the slave server to rotate binary and relay logs.
959 --source include/stop_slave.inc
960
961 --let $rpl_server_number= 2
962 --let $rpl_server_parameters= --relay-log-recovery=1 --debug=d,write_partial_previous_gtids_log_event
963 --source include/rpl_restart_server.inc
964
965 --let $rpl_server_number= 2
966 --let $rpl_server_parameters= --relay-log-recovery=1
967 --source include/rpl_restart_server.inc
968
969 --connection slave
970 --disable_warnings
971 --source include/start_slave.inc
972 --enable_warnings
973 # 9.4 - Rotates both the binary logs on the slave and master.
974 FLUSH LOGS;
975 --connection master
976 FLUSH LOGS;
977
978 inc $i;
979 }
980
981 --disable_warnings
982 --source include/rpl_reset.inc
983 --enable_warnings
984
985 --connection master
986 DROP TABLE t1;
987
988 --echo # Failure on creating compression thread
989 --source include/sync_slave_sql_with_master.inc
990 --source include/stop_slave.inc
991 call mtr.add_suppression("Can not create thread to compress gtid_executed table .*");
992 --let $rpl_server_number= 2
993 --let $rpl_server_parameters= --debug=d,simulate_create_compress_thread_failure
994 --source include/rpl_restart_server.inc
995 --let $assert_text= compression thread is destroied;
996 --let $assert_cond= COUNT(*) = 0 FROM performance_schema.threads WHERE NAME LIKE "%compress_gtid_table"
997 --source include/assert.inc
998 call mtr.add_suppression("Plugin 'InnoDB' will be forced to shutdown");
999 call mtr.add_suppression("Plugin 'InnoDB' has ref_count=.* after shutdown");
1000 --let $rpl_server_parameters=
1001 # Restart slave server without setting simulate_create_compress_thread_failure
1002 --source include/rpl_restart_server.inc
1003 --source include/start_slave.inc
1004
1005 --source include/rpl_end.inc