| 1 |
--let $rpl_topology=1->2 |
| 2 |
--source include/rpl_init.inc |
| 3 |
|
| 4 |
--connection server_2 |
| 5 |
--source include/stop_slave.inc |
| 6 |
SET @slave_old_strict= @@GLOBAL.gtid_strict_mode; |
| 7 |
SET GLOBAL gtid_strict_mode= 1; |
| 8 |
CHANGE MASTER TO master_use_gtid=slave_pos; |
| 9 |
--source include/start_slave.inc |
| 10 |
|
| 11 |
--connection server_1 |
| 12 |
SET @master_old_strict= @@GLOBAL.gtid_strict_mode; |
| 13 |
SET GLOBAL gtid_strict_mode= 1; |
| 14 |
CREATE TABLE t1 (a INT PRIMARY KEY); |
| 15 |
INSERT INTO t1 VALUES (1); |
| 16 |
--save_master_pos |
| 17 |
|
| 18 |
--connection server_2 |
| 19 |
--sync_with_master |
| 20 |
SELECT * FROM t1 ORDER BY a; |
| 21 |
|
| 22 |
--source include/stop_slave.inc |
| 23 |
|
| 24 |
--connection server_1 |
| 25 |
INSERT INTO t1 VALUES (2); |
| 26 |
INSERT INTO t1 VALUES (3); |
| 27 |
--let $old_gtid_pos= `SELECT @@GLOBAL.gtid_current_pos` |
| 28 |
RESET MASTER; |
| 29 |
--replace_result $old_gtid_pos OLD_GTID_POS |
| 30 |
eval SET GLOBAL gtid_slave_pos= '$old_gtid_pos'; |
| 31 |
|
| 32 |
--connection server_2 |
| 33 |
--source include/start_slave.inc |
| 34 |
|
| 35 |
--connection server_1 |
| 36 |
INSERT INTO t1 VALUES (4); |
| 37 |
--source include/save_master_gtid.inc |
| 38 |
|
| 39 |
--connection server_2 |
| 40 |
SET sql_log_bin= 0; |
| 41 |
CALL mtr.add_suppression("The binlog on the master is missing the GTID"); |
| 42 |
SET sql_log_bin= 1; |
| 43 |
--let $slave_io_errno=1236 |
| 44 |
--source include/wait_for_slave_io_error.inc |
| 45 |
|
| 46 |
STOP SLAVE SQL_THREAD; |
| 47 |
--replace_result $old_gtid_pos OLD_GTID_POS |
| 48 |
eval SET GLOBAL gtid_slave_pos= '$old_gtid_pos'; |
| 49 |
|
| 50 |
--source include/start_slave.inc |
| 51 |
--source include/sync_with_master_gtid.inc |
| 52 |
SELECT * FROM t1 ORDER BY a; |
| 53 |
|
| 54 |
--source include/stop_slave.inc |
| 55 |
RESET SLAVE ALL; |
| 56 |
RESET MASTER; |
| 57 |
SET GLOBAL gtid_slave_pos= '0-2-10'; |
| 58 |
|
| 59 |
--connection server_1 |
| 60 |
--replace_result $SERVER_MYPORT_2 SERVER_MYPORT_2 |
| 61 |
eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_2, |
| 62 |
master_user= 'root', master_ssl_verify_server_cert=0, master_use_gtid=CURRENT_POS; |
| 63 |
START SLAVE; |
| 64 |
|
| 65 |
--connection server_2 |
| 66 |
INSERT INTO t1 VALUES (11); |
| 67 |
--save_master_pos |
| 68 |
|
| 69 |
--connection server_1 |
| 70 |
SET sql_log_bin= 0; |
| 71 |
CALL mtr.add_suppression("which is not in the master's binlog. Since the master's binlog contains GTIDs with higher sequence numbers, it probably means that the slave has diverged"); |
| 72 |
SET sql_log_bin= 1; |
| 73 |
--let $slave_io_errno=1236 |
| 74 |
--source include/wait_for_slave_io_error.inc |
| 75 |
|
| 76 |
--connection server_1 |
| 77 |
STOP SLAVE SQL_THREAD; |
| 78 |
SET GLOBAL gtid_slave_pos= '0-2-10'; |
| 79 |
SET GLOBAL gtid_strict_mode= 0; |
| 80 |
--source include/start_slave.inc |
| 81 |
--sync_with_master |
| 82 |
SELECT * FROM t1 ORDER BY a; |
| 83 |
|
| 84 |
--source include/stop_slave.inc |
| 85 |
RESET SLAVE ALL; |
| 86 |
--let $old_gtid_pos= `SELECT @@GLOBAL.gtid_current_pos` |
| 87 |
INSERT INTO t1 VALUES (12); |
| 88 |
--save_master_pos |
| 89 |
|
| 90 |
--connection server_2 |
| 91 |
INSERT INTO t1 VALUES (22); |
| 92 |
--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1 |
| 93 |
eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $SERVER_MYPORT_1, |
| 94 |
master_user= 'root', master_use_gtid=CURRENT_POS; |
| 95 |
START SLAVE; |
| 96 |
SET sql_log_bin= 0; |
| 97 |
CALL mtr.add_suppression("which is not in the master's binlog. Since the master's binlog contains GTIDs with higher sequence numbers, it probably means that the slave has diverged"); |
| 98 |
SET sql_log_bin= 1; |
| 99 |
--let $slave_io_errno=1236 |
| 100 |
--source include/wait_for_slave_io_error.inc |
| 101 |
STOP SLAVE SQL_THREAD; |
| 102 |
SET GLOBAL gtid_strict_mode= 0; |
| 103 |
CHANGE MASTER TO master_use_gtid=SLAVE_POS; |
| 104 |
--replace_result $old_gtid_pos OLD_GTID_POS |
| 105 |
eval SET GLOBAL gtid_slave_pos= '$old_gtid_pos'; |
| 106 |
--source include/start_slave.inc |
| 107 |
--sync_with_master |
| 108 |
SELECT * FROM t1 ORDER BY a; |
| 109 |
|
| 110 |
# Clean up. |
| 111 |
--connection server_2 |
| 112 |
SET GLOBAL gtid_strict_mode= @slave_old_strict; |
| 113 |
|
| 114 |
--connection server_1 |
| 115 |
DROP TABLE t1; |
| 116 |
SET GLOBAL gtid_strict_mode= @master_old_strict; |
| 117 |
|
| 118 |
--source include/rpl_end.inc |