| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# Test verifies that replicated transaction boundaries are set properly |
| 4 |
# at receiving from master time. |
| 5 |
# |
| 6 |
# ==== Implementation ==== |
| 7 |
# |
| 8 |
# A. Simulate an unnoticeable loss of Xid event to observe a slave error, |
| 9 |
# then restart slave to recover from the failure. |
| 10 |
# B. Do the same to GTID event. |
| 11 |
# |
| 12 |
# ==== References ==== |
| 13 |
# |
| 14 |
# MDEV-27697 slave must recognize incomplete replication event group |
| 15 |
# |
| 16 |
--source include/have_binlog_format_mixed.inc |
| 17 |
--source include/have_innodb.inc |
| 18 |
--source include/have_debug.inc |
| 19 |
--source include/master-slave.inc |
| 20 |
|
| 21 |
--connection slave |
| 22 |
call mtr.add_suppression("Unexpected break of being relay-logged GTID 0-27697-1000"); |
| 23 |
call mtr.add_suppression("Relay log write failure: could not queue event from master"); |
| 24 |
call mtr.add_suppression("The current group of events starts with a non-GTID"); |
| 25 |
|
| 26 |
--source include/stop_slave.inc |
| 27 |
CHANGE MASTER TO MASTER_USE_GTID=slave_pos; |
| 28 |
--source include/start_slave.inc |
| 29 |
|
| 30 |
--connection master |
| 31 |
CREATE TABLE t (a INT) ENGINE=innodb; |
| 32 |
INSERT INTO t VALUES(1); |
| 33 |
save_master_pos; |
| 34 |
|
| 35 |
--echo ### A. Simulate an unnoticeable loss of Xid event |
| 36 |
--sync_slave_with_master |
| 37 |
SET @@global.debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000"; |
| 38 |
|
| 39 |
--connection master |
| 40 |
SET @@gtid_seq_no=1000; |
| 41 |
set @@server_id=27697; |
| 42 |
INSERT INTO t VALUES(1000); |
| 43 |
set @@server_id=default; |
| 44 |
INSERT INTO t VALUES(1001); |
| 45 |
|
| 46 |
--echo ## Prove the error occurs. |
| 47 |
--connection slave |
| 48 |
# ER_SLAVE_RELAY_LOG_WRITE_FAILURE |
| 49 |
--let $slave_io_errno = 1595 |
| 50 |
--source include/wait_for_slave_io_error.inc |
| 51 |
## EOP |
| 52 |
|
| 53 |
--echo ## Prove the slave recovers after the simulation condtion is lifted. |
| 54 |
SET @@global.debug_dbug=default; |
| 55 |
--source include/start_slave.inc |
| 56 |
|
| 57 |
--echo ### B. Do the same to GTID event. |
| 58 |
--connection slave |
| 59 |
SET @@global.debug_dbug="+d,slave_discard_gtid_0_x_1002"; |
| 60 |
|
| 61 |
--connection master |
| 62 |
SET @@gtid_seq_no=1002; |
| 63 |
set @@server_id=27697; |
| 64 |
INSERT INTO t VALUES(1002); |
| 65 |
set @@server_id=default; |
| 66 |
INSERT INTO t VALUES(1003); |
| 67 |
|
| 68 |
--echo ## Prove the error occurs. |
| 69 |
--connection slave |
| 70 |
# ER_SLAVE_RELAY_LOG_WRITE_FAILURE |
| 71 |
--let $slave_io_errno = 1595 |
| 72 |
--source include/wait_for_slave_io_error.inc |
| 73 |
## EOP |
| 74 |
|
| 75 |
--echo ## Prove the slave recovers after the simulation condtion is lifted. |
| 76 |
SET @@global.debug_dbug=default; |
| 77 |
--source include/start_slave.inc |
| 78 |
|
| 79 |
--connection master |
| 80 |
save_master_pos; |
| 81 |
|
| 82 |
--sync_slave_with_master |
| 83 |
## EOP |
| 84 |
|
| 85 |
--let $diff_tables=master:t,slave:t |
| 86 |
--source include/diff_tables.inc |
| 87 |
|
| 88 |
--echo "===== Clean up =====" |
| 89 |
--connection slave |
| 90 |
--source include/stop_slave.inc |
| 91 |
CHANGE MASTER TO MASTER_USE_GTID=no; |
| 92 |
--source include/start_slave.inc |
| 93 |
|
| 94 |
--connection master |
| 95 |
DROP TABLE t; |
| 96 |
--source include/rpl_end.inc |