| 1 |
include/rpl_init.inc [topology=1->2] |
| 2 |
*** Test connecting with empty GTID state to start from very beginning of binlog *** |
| 3 |
connection server_2; |
| 4 |
include/stop_slave.inc |
| 5 |
RESET MASTER; |
| 6 |
RESET SLAVE; |
| 7 |
connection server_1; |
| 8 |
RESET MASTER; |
| 9 |
FLUSH LOGS; |
| 10 |
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; |
| 11 |
connection server_2; |
| 12 |
SET GLOBAL gtid_slave_pos=""; |
| 13 |
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT, |
| 14 |
MASTER_USE_GTID=SLAVE_POS; |
| 15 |
include/start_slave.inc |
| 16 |
SELECT * FROM t1; |
| 17 |
a |
| 18 |
connection server_1; |
| 19 |
INSERT INTO t1 VALUES (1); |
| 20 |
connection server_2; |
| 21 |
SELECT * FROM t1; |
| 22 |
a |
| 23 |
1 |
| 24 |
include/stop_slave.inc |
| 25 |
*** Test that master gives error when slave asks for empty gtid pos and binlog files have been purged. *** |
| 26 |
connection server_1; |
| 27 |
FLUSH LOGS; |
| 28 |
INSERT INTO t1 VALUES (2); |
| 29 |
include/wait_for_purge.inc "master-bin.000003" |
| 30 |
show binary logs; |
| 31 |
Log_name File_size |
| 32 |
master-bin.000003 # |
| 33 |
connection server_2; |
| 34 |
SET GLOBAL gtid_slave_pos=""; |
| 35 |
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT, |
| 36 |
MASTER_USE_GTID=SLAVE_POS; |
| 37 |
START SLAVE; |
| 38 |
include/wait_for_slave_io_error.inc [errno=1236] |
| 39 |
include/stop_slave_sql.inc |
| 40 |
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT, |
| 41 |
MASTER_LOG_FILE="master-bin.000003", MASTER_LOG_POS=4, MASTER_USE_GTID=NO; |
| 42 |
include/start_slave.inc |
| 43 |
SELECT * FROM t1 ORDER BY a; |
| 44 |
a |
| 45 |
1 |
| 46 |
2 |
| 47 |
SET sql_log_bin=0; |
| 48 |
call mtr.add_suppression('Could not find GTID state requested by slave in any binlog files'); |
| 49 |
SET sql_log_bin=1; |
| 50 |
*** Test that we give warning when explict @@gtid_slave_pos=xxx that conflicts with what is in our binary log *** |
| 51 |
include/stop_slave.inc |
| 52 |
connection server_1; |
| 53 |
INSERT INTO t1 VALUES(3); |
| 54 |
include/save_master_gtid.inc |
| 55 |
connection server_2; |
| 56 |
SET GLOBAL gtid_slave_pos='0-1-3'; |
| 57 |
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT, |
| 58 |
MASTER_USE_GTID=SLAVE_POS; |
| 59 |
include/start_slave.inc |
| 60 |
include/sync_with_master_gtid.inc |
| 61 |
SELECT * FROM t1 ORDER by a; |
| 62 |
a |
| 63 |
1 |
| 64 |
2 |
| 65 |
3 |
| 66 |
include/stop_slave.inc |
| 67 |
connection server_1; |
| 68 |
INSERT INTO t1 VALUES (4); |
| 69 |
include/save_master_gtid.inc |
| 70 |
connection server_2; |
| 71 |
INSERT INTO t1 VALUES (10); |
| 72 |
DELETE FROM t1 WHERE a=10; |
| 73 |
SET GLOBAL gtid_slave_pos='0-1-4'; |
| 74 |
Warnings: |
| 75 |
Warning 1947 Specified GTID 0-1-4 conflicts with the binary log which contains a more recent GTID 0-2-6. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos |
| 76 |
RESET MASTER; |
| 77 |
SET GLOBAL gtid_slave_pos='0-1-4'; |
| 78 |
START SLAVE; |
| 79 |
include/sync_with_master_gtid.inc |
| 80 |
SELECT * FROM t1 ORDER by a; |
| 81 |
a |
| 82 |
1 |
| 83 |
2 |
| 84 |
3 |
| 85 |
4 |
| 86 |
connection server_1; |
| 87 |
DROP TABLE t1; |
| 88 |
connection server_2; |
| 89 |
*** MDEV-4275: I/O thread restart duplicates events in relay log *** |
| 90 |
connection server_2; |
| 91 |
include/stop_slave.inc |
| 92 |
RESET SLAVE ALL; |
| 93 |
RESET MASTER; |
| 94 |
connection server_1; |
| 95 |
RESET MASTER; |
| 96 |
connection server_2; |
| 97 |
SET GLOBAL gtid_slave_pos=''; |
| 98 |
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos; |
| 99 |
include/start_slave.inc |
| 100 |
connection server_1; |
| 101 |
CREATE TABLE t1 (a INT PRIMARY KEY); |
| 102 |
INSERT INTO t1 VALUES (1); |
| 103 |
connection server_2; |
| 104 |
SELECT * FROM t1; |
| 105 |
a |
| 106 |
1 |
| 107 |
include/stop_slave_io.inc |
| 108 |
START SLAVE IO_THREAD; |
| 109 |
include/wait_for_slave_io_to_start.inc |
| 110 |
connection server_1; |
| 111 |
INSERT INTO t1 VALUES (2); |
| 112 |
connection server_2; |
| 113 |
SELECT * FROM t1 ORDER BY a; |
| 114 |
a |
| 115 |
1 |
| 116 |
2 |
| 117 |
*** MDEV-4329: GTID_SLAVE_POS='' is not checked for conflicts with binlog *** |
| 118 |
connection server_2; |
| 119 |
include/stop_slave.inc |
| 120 |
DROP TABLE t1; |
| 121 |
RESET SLAVE; |
| 122 |
SET GLOBAL gtid_slave_pos=""; |
| 123 |
Warnings: |
| 124 |
Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-4. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos |
| 125 |
RESET MASTER; |
| 126 |
SET GLOBAL gtid_slave_pos=""; |
| 127 |
include/start_slave.inc |
| 128 |
SELECT * FROM t1 ORDER BY a; |
| 129 |
a |
| 130 |
1 |
| 131 |
2 |
| 132 |
connection server_2; |
| 133 |
include/stop_slave.inc |
| 134 |
SET SQL_LOG_BIN=0; |
| 135 |
DROP TABLE t1; |
| 136 |
SET SQL_LOG_BIN=1; |
| 137 |
RESET SLAVE; |
| 138 |
SET GLOBAL gtid_slave_pos=""; |
| 139 |
SET @save_slave_ddl_exec_mode=@@global.slave_ddl_exec_mode; |
| 140 |
SET GLOBAL slave_ddl_exec_mode=STRICT; |
| 141 |
include/start_slave.inc |
| 142 |
SELECT * FROM t1 ORDER BY a; |
| 143 |
a |
| 144 |
1 |
| 145 |
2 |
| 146 |
*** Test that RESET SLAVE clears the Using_Gtid flag. *** |
| 147 |
include/stop_slave.inc |
| 148 |
include/reset_slave.inc |
| 149 |
Using_Gtid = 'No' |
| 150 |
START SLAVE; |
| 151 |
include/wait_for_slave_sql_error.inc [errno=1050] |
| 152 |
STOP SLAVE IO_THREAD; |
| 153 |
CHANGE MASTER TO MASTER_USE_GTID=SLAVE_POS; |
| 154 |
include/start_slave.inc |
| 155 |
connection server_1; |
| 156 |
INSERT INTO t1 VALUES(3); |
| 157 |
include/save_master_gtid.inc |
| 158 |
connection server_2; |
| 159 |
include/sync_with_master_gtid.inc |
| 160 |
SELECT * FROM t1 ORDER BY a; |
| 161 |
a |
| 162 |
1 |
| 163 |
2 |
| 164 |
3 |
| 165 |
SET SQL_LOG_BIN=0; |
| 166 |
call mtr.add_suppression("Slave: Table 't1' already exists error.* 1050"); |
| 167 |
SET SQL_LOG_BIN=1; |
| 168 |
*** Test reconnecting slave with GTID after purge logs on master. *** |
| 169 |
connection server_1; |
| 170 |
FLUSH LOGS; |
| 171 |
INSERT INTO t1 VALUES (4); |
| 172 |
include/save_master_gtid.inc |
| 173 |
connection server_2; |
| 174 |
include/sync_with_master_gtid.inc |
| 175 |
include/stop_slave.inc |
| 176 |
connection server_1; |
| 177 |
FLUSH LOGS; |
| 178 |
FLUSH LOGS; |
| 179 |
include/wait_for_purge.inc "master-bin.000004" |
| 180 |
show binary logs; |
| 181 |
Log_name File_size |
| 182 |
master-bin.000004 # |
| 183 |
INSERT INTO t1 VALUES (5); |
| 184 |
include/save_master_gtid.inc |
| 185 |
connection server_2; |
| 186 |
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT; |
| 187 |
include/start_slave.inc |
| 188 |
include/sync_with_master_gtid.inc |
| 189 |
SELECT * FROM t1 ORDER BY a; |
| 190 |
a |
| 191 |
1 |
| 192 |
2 |
| 193 |
3 |
| 194 |
4 |
| 195 |
5 |
| 196 |
*** Test modifying binlog on slave and the effect on GTID state. *** |
| 197 |
connection server_2; |
| 198 |
include/stop_slave.inc |
| 199 |
RESET MASTER; |
| 200 |
SET GLOBAL gtid_slave_pos=""; |
| 201 |
connection server_1; |
| 202 |
RESET MASTER; |
| 203 |
TRUNCATE TABLE t1; |
| 204 |
INSERT INTO t1 VALUES (10); |
| 205 |
include/save_master_gtid.inc |
| 206 |
connection server_2; |
| 207 |
include/start_slave.inc |
| 208 |
include/sync_with_master_gtid.inc |
| 209 |
SELECT * FROM t1; |
| 210 |
a |
| 211 |
10 |
| 212 |
SELECT 'Slave_Pos' AS Using_Gtid; |
| 213 |
Using_Gtid |
| 214 |
Slave_Pos |
| 215 |
SELECT '0-1-2' AS Gtid_Slave_Pos; |
| 216 |
Gtid_Slave_Pos |
| 217 |
0-1-2 |
| 218 |
UPDATE t1 SET a=9 WHERE a=10; |
| 219 |
UPDATE t1 SET a=10 WHERE a=9; |
| 220 |
SELECT '0-2-4' AS Gtid_Slave_Pos; |
| 221 |
Gtid_Slave_Pos |
| 222 |
0-2-4 |
| 223 |
include/stop_slave.inc |
| 224 |
SET GLOBAL gtid_slave_pos='0-1-2'; |
| 225 |
Warnings: |
| 226 |
Warning 1947 Specified GTID 0-1-2 conflicts with the binary log which contains a more recent GTID 0-2-4. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos |
| 227 |
RESET MASTER; |
| 228 |
SELECT '0-1-2' AS Gtid_Slave_Pos; |
| 229 |
Gtid_Slave_Pos |
| 230 |
0-1-2 |
| 231 |
SET GLOBAL gtid_slave_pos='0-1-2'; |
| 232 |
include/start_slave.inc |
| 233 |
SELECT '0-1-2' AS Gtid_Slave_Pos; |
| 234 |
Gtid_Slave_Pos |
| 235 |
0-1-2 |
| 236 |
*** MDEV-4483: Slave loses traditional master coordinates immediately on CHANGE MASTER TO MASTER_USE_GTID = 1 *** |
| 237 |
connection server_2; |
| 238 |
include/stop_slave.inc |
| 239 |
DROP TABLE t1; |
| 240 |
RESET SLAVE ALL; |
| 241 |
CHANGE MASTER TO MASTER_USE_GTID=NO; |
| 242 |
RESET MASTER; |
| 243 |
SET GLOBAL gtid_slave_pos= ""; |
| 244 |
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=no, master_log_file="", master_log_pos= 4; |
| 245 |
connection server_1; |
| 246 |
DROP TABLE t1; |
| 247 |
RESET MASTER; |
| 248 |
CREATE TABLE t1 (a INT PRIMARY KEY); |
| 249 |
connection server_2; |
| 250 |
include/start_slave.inc |
| 251 |
include/stop_slave.inc |
| 252 |
connection server_1; |
| 253 |
INSERT INTO t1 VALUES (1); |
| 254 |
INSERT INTO t1 VALUES (2); |
| 255 |
connection server_2; |
| 256 |
START SLAVE UNTIL master_log_file='LOG_FILE1', master_log_pos=LOG_POS1; |
| 257 |
include/wait_for_slave_sql_to_stop.inc |
| 258 |
SELECT * FROM t1; |
| 259 |
a |
| 260 |
1 |
| 261 |
include/wait_for_slave_param.inc [Read_Master_Log_Pos] |
| 262 |
include/stop_slave_io.inc |
| 263 |
CHANGE MASTER TO master_use_gtid=slave_pos; |
| 264 |
SET GLOBAL gtid_slave_pos="0-42-42"; |
| 265 |
SET sql_log_bin=0; |
| 266 |
call mtr.add_suppression("Error: connecting slave requested to start from GTID"); |
| 267 |
SET sql_log_bin=1; |
| 268 |
START SLAVE; |
| 269 |
include/wait_for_slave_io_error.inc [errno=1236] |
| 270 |
STOP SLAVE SQL_THREAD; |
| 271 |
include/wait_for_slave_sql_to_stop.inc |
| 272 |
CHANGE MASTER TO master_use_gtid=no; |
| 273 |
include/start_slave.inc |
| 274 |
SELECT * FROM t1 ORDER BY a; |
| 275 |
a |
| 276 |
1 |
| 277 |
2 |
| 278 |
connection server_1; |
| 279 |
DROP TABLE t1; |
| 280 |
connection server_2; |
| 281 |
set @@global.slave_ddl_exec_mode=@save_slave_ddl_exec_mode; |
| 282 |
include/rpl_end.inc |