| 1 |
--let $rpl_topology=1->2 |
| 2 |
--source include/rpl_init.inc |
| 3 |
--source include/have_innodb.inc |
| 4 |
--source include/have_debug.inc |
| 5 |
|
| 6 |
|
| 7 |
--connection server_1 |
| 8 |
CREATE TABLE t1 (a INT); |
| 9 |
FLUSH LOGS; |
| 10 |
--save_master_pos |
| 11 |
|
| 12 |
--connection server_2 |
| 13 |
--sync_with_master |
| 14 |
|
| 15 |
|
| 16 |
# Prepare a string of events and have the slave replicate all of it. |
| 17 |
--connection server_1 |
| 18 |
SET gtid_domain_id=10; |
| 19 |
INSERT INTO t1 VALUES (1); |
| 20 |
INSERT INTO t1 VALUES (2); |
| 21 |
SET gtid_seq_no=100; |
| 22 |
INSERT INTO t1 VALUES (3); |
| 23 |
INSERT INTO t1 VALUES (4); |
| 24 |
INSERT INTO t1 VALUES (5); |
| 25 |
--save_master_pos |
| 26 |
|
| 27 |
--connection server_2 |
| 28 |
--sync_with_master |
| 29 |
--source include/stop_slave.inc |
| 30 |
SELECT * FROM t1 ORDER BY a; |
| 31 |
|
| 32 |
# Now start the slave again, but force a reconnect. There was a bug that this |
| 33 |
# reconnect would cause duplicate events. |
| 34 |
|
| 35 |
--connection server_1 |
| 36 |
# Make sure to get rid of any old binlog dump thread so it does not |
| 37 |
# interfere with our DBUG error injection. |
| 38 |
--source include/kill_binlog_dump_threads.inc |
| 39 |
INSERT INTO t1 VALUES (10); |
| 40 |
SET @old_debug= @@GLOBAL.debug_dbug; |
| 41 |
SET GLOBAL debug_dbug="+d,dummy_disable_default_dbug_output"; |
| 42 |
SET GLOBAL debug_dbug="+d,gtid_force_reconnect_at_10_1_100"; |
| 43 |
--save_master_pos |
| 44 |
|
| 45 |
--connection server_2 |
| 46 |
--source include/start_slave.inc |
| 47 |
--sync_with_master |
| 48 |
SELECT * FROM t1 ORDER BY a; |
| 49 |
|
| 50 |
--source include/stop_slave.inc |
| 51 |
TRUNCATE t1; |
| 52 |
RESET MASTER; |
| 53 |
SET GLOBAL gtid_slave_pos= ""; |
| 54 |
|
| 55 |
--connection server_1 |
| 56 |
SET GLOBAL debug_dbug= @old_debug; |
| 57 |
TRUNCATE t1; |
| 58 |
RESET MASTER; |
| 59 |
|
| 60 |
# A1 B1 A2 B2 A3 B3, slave reached A1 and B3 and stopped. Slave starts, |
| 61 |
# reconnects at A2. There was a bug that B2 would be duplicated. |
| 62 |
|
| 63 |
SET gtid_domain_id=10; |
| 64 |
SET gtid_seq_no=50; |
| 65 |
INSERT INTO t1 VALUES (1); |
| 66 |
SET gtid_domain_id=11; |
| 67 |
INSERT INTO t1 VALUES (11); |
| 68 |
SET gtid_domain_id=10; |
| 69 |
SET gtid_seq_no=100; |
| 70 |
INSERT INTO t1 VALUES (2); |
| 71 |
SET gtid_domain_id=11; |
| 72 |
INSERT INTO t1 VALUES (12); |
| 73 |
SET gtid_domain_id=10; |
| 74 |
INSERT INTO t1 VALUES (3); |
| 75 |
SET gtid_domain_id=11; |
| 76 |
SET gtid_seq_no=200; |
| 77 |
INSERT INTO t1 VALUES (13); |
| 78 |
|
| 79 |
--connection server_2 |
| 80 |
START SLAVE UNTIL master_gtid_pos="10-1-50,11-1-200"; |
| 81 |
--source include/wait_for_slave_to_stop.inc |
| 82 |
SELECT * FROM t1 ORDER BY a; |
| 83 |
|
| 84 |
--connection server_1 |
| 85 |
--source include/kill_binlog_dump_threads.inc |
| 86 |
INSERT INTO t1 VALUES (20); |
| 87 |
SET GLOBAL debug_dbug="+d,dummy_disable_default_dbug_output"; |
| 88 |
SET GLOBAL debug_dbug="+d,gtid_force_reconnect_at_10_1_100"; |
| 89 |
--save_master_pos |
| 90 |
|
| 91 |
--connection server_2 |
| 92 |
--source include/start_slave.inc |
| 93 |
--sync_with_master |
| 94 |
SELECT * FROM t1 ORDER BY a; |
| 95 |
|
| 96 |
--source include/stop_slave.inc |
| 97 |
TRUNCATE t1; |
| 98 |
RESET MASTER; |
| 99 |
SET GLOBAL gtid_slave_pos= ""; |
| 100 |
|
| 101 |
--connection server_1 |
| 102 |
SET GLOBAL debug_dbug= @old_debug; |
| 103 |
TRUNCATE t1; |
| 104 |
RESET MASTER; |
| 105 |
|
| 106 |
# A1 B1 A2 B2 A3 B3. START SLAVE UNTIL A1,B3, gets reconnect at B2. |
| 107 |
# There was a bug that the UNTIL would be ignored, and A2 would be lost. |
| 108 |
|
| 109 |
--source include/kill_binlog_dump_threads.inc |
| 110 |
SET gtid_domain_id= 9; |
| 111 |
SET gtid_seq_no= 50; |
| 112 |
INSERT INTO t1 VALUES (1); |
| 113 |
SET gtid_domain_id= 10; |
| 114 |
INSERT INTO t1 VALUES (11); |
| 115 |
SET gtid_domain_id= 9; |
| 116 |
INSERT INTO t1 VALUES (2); |
| 117 |
SET gtid_domain_id= 10; |
| 118 |
SET gtid_seq_no= 100; |
| 119 |
INSERT INTO t1 VALUES (12); |
| 120 |
SET gtid_domain_id= 9; |
| 121 |
INSERT INTO t1 VALUES (3); |
| 122 |
SET gtid_domain_id= 10; |
| 123 |
SET gtid_seq_no= 200; |
| 124 |
INSERT INTO t1 VALUES (13); |
| 125 |
SET gtid_domain_id= 10; |
| 126 |
|
| 127 |
SET GLOBAL debug_dbug="+d,dummy_disable_default_dbug_output"; |
| 128 |
SET GLOBAL debug_dbug="+d,gtid_force_reconnect_at_10_1_100"; |
| 129 |
|
| 130 |
--connection server_2 |
| 131 |
START SLAVE UNTIL master_gtid_pos="9-1-50,10-1-200"; |
| 132 |
--source include/wait_for_slave_to_stop.inc |
| 133 |
SELECT * FROM t1 ORDER BY a; |
| 134 |
|
| 135 |
--connection server_1 |
| 136 |
SET GLOBAL debug_dbug= @old_debug; |
| 137 |
INSERT INTO t1 VALUES (20); |
| 138 |
--save_master_pos |
| 139 |
|
| 140 |
--connection server_2 |
| 141 |
--source include/start_slave.inc |
| 142 |
--sync_with_master |
| 143 |
SELECT * FROM t1 ORDER BY a; |
| 144 |
|
| 145 |
|
| 146 |
--echo *** Test when slave IO thread needs to reconnect in the middle of an event group. *** |
| 147 |
--connection server_2 |
| 148 |
--source include/stop_slave.inc |
| 149 |
|
| 150 |
TRUNCATE t1; |
| 151 |
RESET MASTER; |
| 152 |
SET GLOBAL gtid_slave_pos= ""; |
| 153 |
|
| 154 |
--connection server_1 |
| 155 |
SET GLOBAL debug_dbug= @old_debug; |
| 156 |
TRUNCATE t1; |
| 157 |
RESET MASTER; |
| 158 |
|
| 159 |
--source include/kill_binlog_dump_threads.inc |
| 160 |
SET GLOBAL debug_dbug="+d,dummy_disable_default_dbug_output"; |
| 161 |
SET GLOBAL debug_dbug="+d,binlog_force_reconnect_after_22_events"; |
| 162 |
|
| 163 |
# 4 events for FD, fake rotate, gtid list, binlog checkpoint. |
| 164 |
# 2 events for GTID, create table |
| 165 |
CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB; |
| 166 |
# 3 events for BEGIN/query/COMMIT |
| 167 |
INSERT INTO t2 VALUES (1); |
| 168 |
# 4 events for BEGIN/query/query/COMMIT |
| 169 |
BEGIN; |
| 170 |
INSERT INTO t2 VALUES (10); |
| 171 |
INSERT INTO t2 VALUES (11); |
| 172 |
COMMIT; |
| 173 |
# So this event group starts after 4+2+4+3=13 events. Or 16 in row-based. |
| 174 |
BEGIN; |
| 175 |
INSERT INTO t2 VALUES (20); |
| 176 |
INSERT INTO t2 VALUES (21); |
| 177 |
INSERT INTO t2 VALUES (22); |
| 178 |
INSERT INTO t2 VALUES (23); |
| 179 |
INSERT INTO t2 VALUES (24); |
| 180 |
INSERT INTO t2 VALUES (25); |
| 181 |
INSERT INTO t2 VALUES (26); |
| 182 |
INSERT INTO t2 VALUES (27); |
| 183 |
INSERT INTO t2 VALUES (28); |
| 184 |
INSERT INTO t2 VALUES (29); |
| 185 |
COMMIT; |
| 186 |
--save_master_pos |
| 187 |
|
| 188 |
--connection server_2 |
| 189 |
--source include/start_slave.inc |
| 190 |
--sync_with_master |
| 191 |
SELECT * FROM t2 ORDER BY a; |
| 192 |
|
| 193 |
--connection server_1 |
| 194 |
SET GLOBAL debug_dbug= @old_debug; |
| 195 |
|
| 196 |
|
| 197 |
# Clean up. |
| 198 |
--connection server_1 |
| 199 |
DROP TABLE t1, t2; |
| 200 |
|
| 201 |
--source include/rpl_end.inc |