| 1 |
include/rpl_init.inc [topology=1->2] |
| 2 |
connection server_1; |
| 3 |
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; |
| 4 |
SET sql_log_bin= 0; |
| 5 |
call mtr.add_suppression("Error writing file .*errno: 1950"); |
| 6 |
SET sql_log_bin= 1; |
| 7 |
SET @old_gtid_strict_mode= @@GLOBAL.gtid_strict_mode; |
| 8 |
SET GLOBAL gtid_strict_mode= 1; |
| 9 |
connection server_2; |
| 10 |
include/stop_slave.inc |
| 11 |
SET @old_gtid_strict_mode= @@GLOBAL.gtid_strict_mode; |
| 12 |
SET GLOBAL gtid_strict_mode=1; |
| 13 |
CHANGE MASTER TO master_use_gtid=slave_pos; |
| 14 |
include/start_slave.inc |
| 15 |
connection server_1; |
| 16 |
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; |
| 17 |
INSERT INTO t1 VALUES (1); |
| 18 |
include/show_binlog_events.inc |
| 19 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 20 |
master-bin.000001 # Gtid # # GTID #-#-# |
| 21 |
master-bin.000001 # Query # # use `test`; ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB |
| 22 |
master-bin.000001 # Gtid # # GTID #-#-# |
| 23 |
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB |
| 24 |
master-bin.000001 # Gtid # # BEGIN GTID #-#-# |
| 25 |
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) |
| 26 |
master-bin.000001 # Xid # # COMMIT /* XID */ |
| 27 |
SET server_id= 3; |
| 28 |
SET gtid_seq_no= 3; |
| 29 |
ERROR HY000: An attempt was made to binlog GTID 0-3-3 which would create an out-of-order sequence number with existing GTID 0-1-3, and gtid strict mode is enabled |
| 30 |
SET @old_dbug = @@session.debug_dbug; |
| 31 |
SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check"; |
| 32 |
SET gtid_seq_no= 3; |
| 33 |
SET SESSION debug_dbug=@old_dbug; |
| 34 |
INSERT INTO t1 VALUES (2); |
| 35 |
ERROR HY000: An attempt was made to binlog GTID 0-3-3 which would create an out-of-order sequence number with existing GTID 0-1-3, and gtid strict mode is enabled |
| 36 |
SET gtid_seq_no= 2; |
| 37 |
ERROR HY000: An attempt was made to binlog GTID 0-3-2 which would create an out-of-order sequence number with existing GTID 0-1-3, and gtid strict mode is enabled |
| 38 |
SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check"; |
| 39 |
SET gtid_seq_no= 2; |
| 40 |
SET SESSION debug_dbug=@old_dbug; |
| 41 |
INSERT INTO t1 VALUES (3); |
| 42 |
ERROR HY000: An attempt was made to binlog GTID 0-3-2 which would create an out-of-order sequence number with existing GTID 0-1-3, and gtid strict mode is enabled |
| 43 |
SET server_id= 1; |
| 44 |
SET gtid_seq_no= 4; |
| 45 |
INSERT INTO t1 VALUES (4); |
| 46 |
SELECT * FROM t1 ORDER BY 1; |
| 47 |
a |
| 48 |
1 |
| 49 |
4 |
| 50 |
include/show_binlog_events.inc |
| 51 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 52 |
master-bin.000001 # Gtid # # GTID #-#-# |
| 53 |
master-bin.000001 # Query # # use `test`; ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB |
| 54 |
master-bin.000001 # Gtid # # GTID #-#-# |
| 55 |
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB |
| 56 |
master-bin.000001 # Gtid # # BEGIN GTID #-#-# |
| 57 |
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) |
| 58 |
master-bin.000001 # Xid # # COMMIT /* XID */ |
| 59 |
master-bin.000001 # Gtid # # BEGIN GTID #-#-# |
| 60 |
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4) |
| 61 |
master-bin.000001 # Xid # # COMMIT /* XID */ |
| 62 |
*** Test non-transactional GTID error (cannot be rolled back). *** |
| 63 |
SET server_id= 3; |
| 64 |
SET gtid_seq_no= 1; |
| 65 |
ERROR HY000: An attempt was made to binlog GTID 0-3-1 which would create an out-of-order sequence number with existing GTID 0-1-4, and gtid strict mode is enabled |
| 66 |
SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check"; |
| 67 |
SET gtid_seq_no= 1; |
| 68 |
SET SESSION debug_dbug=@old_dbug; |
| 69 |
CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=MyISAM; |
| 70 |
ERROR HY000: An attempt was made to binlog GTID 0-3-1 which would create an out-of-order sequence number with existing GTID 0-1-4, and gtid strict mode is enabled |
| 71 |
SET sql_log_bin= 0; |
| 72 |
DROP TABLE t2; |
| 73 |
SET sql_log_bin= 1; |
| 74 |
CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=MyISAM; |
| 75 |
SET gtid_seq_no= 1; |
| 76 |
ERROR HY000: An attempt was made to binlog GTID 0-3-1 which would create an out-of-order sequence number with existing GTID 0-3-5, and gtid strict mode is enabled |
| 77 |
SET SESSION debug_dbug="d,ignore_set_gtid_seq_no_check"; |
| 78 |
SET gtid_seq_no= 1; |
| 79 |
SET SESSION debug_dbug=@old_dbug; |
| 80 |
INSERT INTO t2 VALUES (1); |
| 81 |
ERROR HY000: An attempt was made to binlog GTID 0-3-1 which would create an out-of-order sequence number with existing GTID 0-3-5, and gtid strict mode is enabled |
| 82 |
SET server_id= 1; |
| 83 |
SET gtid_seq_no= 6; |
| 84 |
INSERT INTO t2 VALUES (2); |
| 85 |
SELECT * FROM t2 ORDER BY a; |
| 86 |
a |
| 87 |
1 |
| 88 |
2 |
| 89 |
include/show_binlog_events.inc |
| 90 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 91 |
master-bin.000001 # Gtid # # GTID #-#-# |
| 92 |
master-bin.000001 # Query # # use `test`; ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB |
| 93 |
master-bin.000001 # Gtid # # GTID #-#-# |
| 94 |
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB |
| 95 |
master-bin.000001 # Gtid # # BEGIN GTID #-#-# |
| 96 |
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) |
| 97 |
master-bin.000001 # Xid # # COMMIT /* XID */ |
| 98 |
master-bin.000001 # Gtid # # BEGIN GTID #-#-# |
| 99 |
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4) |
| 100 |
master-bin.000001 # Xid # # COMMIT /* XID */ |
| 101 |
master-bin.000001 # Gtid # # GTID #-#-# |
| 102 |
master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=MyISAM |
| 103 |
master-bin.000001 # Gtid # # BEGIN GTID #-#-# |
| 104 |
master-bin.000001 # Query # # use `test`; INSERT INTO t2 VALUES (2) |
| 105 |
master-bin.000001 # Query # # COMMIT |
| 106 |
*** Test that slave stops if it tries to apply a GTID that would create out-of-order binlog GTID sequence numbers. *** |
| 107 |
connection server_2; |
| 108 |
SELECT * FROM t1 ORDER BY a; |
| 109 |
a |
| 110 |
1 |
| 111 |
4 |
| 112 |
SELECT * FROM t2 ORDER BY a; |
| 113 |
a |
| 114 |
2 |
| 115 |
SET sql_log_bin= 0; |
| 116 |
call mtr.add_suppression("An attempt was made to binlog GTID .* which would create an out-of-order sequence number with existing GTID .*, and gtid strict mode is enabled"); |
| 117 |
call mtr.add_suppression("The binlog on the master is missing the GTID [-0-9]+ requested by the slave"); |
| 118 |
SET sql_log_bin= 1; |
| 119 |
INSERT INTO t1 VALUES (5); |
| 120 |
connection server_1; |
| 121 |
INSERT INTO t1 VALUES (6); |
| 122 |
connection server_2; |
| 123 |
include/wait_for_slave_sql_error.inc [errno=1950] |
| 124 |
STOP SLAVE IO_THREAD; |
| 125 |
SET GLOBAL gtid_strict_mode=0; |
| 126 |
include/start_slave.inc |
| 127 |
SET GLOBAL gtid_strict_mode=1; |
| 128 |
SELECT * FROM t1 ORDER BY a; |
| 129 |
a |
| 130 |
1 |
| 131 |
4 |
| 132 |
5 |
| 133 |
6 |
| 134 |
INSERT INTO t1 VALUES (7); |
| 135 |
connection server_1; |
| 136 |
CREATE TABLE t3 (a INT PRIMARY KEY); |
| 137 |
connection server_2; |
| 138 |
include/wait_for_slave_sql_error.inc [errno=1950] |
| 139 |
SHOW CREATE TABLE t3; |
| 140 |
ERROR 42S02: Table 'test.t3' doesn't exist |
| 141 |
STOP SLAVE IO_THREAD; |
| 142 |
SET GLOBAL gtid_strict_mode=0; |
| 143 |
include/start_slave.inc |
| 144 |
SET GLOBAL gtid_strict_mode=1; |
| 145 |
SHOW CREATE TABLE t3; |
| 146 |
Table t3 |
| 147 |
Create Table CREATE TABLE `t3` ( |
| 148 |
`a` int(11) NOT NULL, |
| 149 |
PRIMARY KEY (`a`) |
| 150 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 151 |
INSERT INTO t1 VALUES (8); |
| 152 |
connection server_1; |
| 153 |
INSERT INTO t2 VALUES (3); |
| 154 |
connection server_2; |
| 155 |
include/wait_for_slave_sql_error.inc [errno=1950] |
| 156 |
SELECT * FROM t2 ORDER BY a; |
| 157 |
a |
| 158 |
2 |
| 159 |
STOP SLAVE IO_THREAD; |
| 160 |
SET GLOBAL gtid_strict_mode=0; |
| 161 |
include/start_slave.inc |
| 162 |
SET GLOBAL gtid_strict_mode=1; |
| 163 |
SELECT * FROM t2 ORDER BY a; |
| 164 |
a |
| 165 |
2 |
| 166 |
3 |
| 167 |
*** Check slave requests starting from a hole on the master. *** |
| 168 |
connection server_2; |
| 169 |
include/stop_slave.inc |
| 170 |
connection server_1; |
| 171 |
INSERT INTO t1 VALUES (10); |
| 172 |
SET gtid_seq_no= 100; |
| 173 |
INSERT INTO t1 VALUES (11); |
| 174 |
INSERT INTO t1 VALUES (12); |
| 175 |
connection server_2; |
| 176 |
SET GLOBAL gtid_slave_pos= "0-1-50"; |
| 177 |
START SLAVE; |
| 178 |
include/wait_for_slave_io_error.inc [errno=1236] |
| 179 |
STOP SLAVE SQL_THREAD; |
| 180 |
SET GLOBAL gtid_strict_mode= 0; |
| 181 |
include/start_slave.inc |
| 182 |
SELECT * FROM t1 ORDER BY a; |
| 183 |
a |
| 184 |
1 |
| 185 |
4 |
| 186 |
5 |
| 187 |
6 |
| 188 |
7 |
| 189 |
8 |
| 190 |
11 |
| 191 |
12 |
| 192 |
SET GLOBAL gtid_strict_mode= 1; |
| 193 |
connection server_1; |
| 194 |
DROP TABLE t1, t2, t3; |
| 195 |
SET GLOBAL gtid_strict_mode= @old_gtid_strict_mode; |
| 196 |
connection server_2; |
| 197 |
SET GLOBAL gtid_strict_mode= @old_gtid_strict_mode; |
| 198 |
include/rpl_end.inc |