| 1 |
include/rpl_init.inc [topology=1->2->3->4] |
| 2 |
connection server_1; |
| 3 |
*** GTID position should be empty here *** |
| 4 |
SELECT BINLOG_GTID_POS('<BINLOG_FILE>',<BINLOG_POS>); |
| 5 |
BINLOG_GTID_POS('<BINLOG_FILE>',<BINLOG_POS>) |
| 6 |
|
| 7 |
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM; |
| 8 |
CREATE TABLE t2 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB; |
| 9 |
INSERT INTO t1 VALUES (1, "m1"); |
| 10 |
INSERT INTO t1 VALUES (2, "m2"), (3, "m3"), (4, "m4"); |
| 11 |
INSERT INTO t2 VALUES (1, "i1"); |
| 12 |
BEGIN; |
| 13 |
INSERT INTO t2 VALUES (2, "i2"), (3, "i3"); |
| 14 |
INSERT INTO t2 VALUES (4, "i4"); |
| 15 |
COMMIT; |
| 16 |
*** GTID position should be non-empty here *** |
| 17 |
SELECT BINLOG_GTID_POS('<BINLOG_FILE>',<BINLOG_POS>); |
| 18 |
BINLOG_GTID_POS('<BINLOG_FILE>',<BINLOG_POS>) |
| 19 |
<GTID_POS_SERVER_1> |
| 20 |
connection server_2; |
| 21 |
*** GTID position should be the same as on server_1 *** |
| 22 |
SELECT BINLOG_GTID_POS('<BINLOG_FILE>',<BINLOG_POS>); |
| 23 |
BINLOG_GTID_POS('<BINLOG_FILE>',<BINLOG_POS>) |
| 24 |
<GTID_POS_SERVER_1> |
| 25 |
SELECT * FROM t1 ORDER BY a; |
| 26 |
a b |
| 27 |
1 m1 |
| 28 |
2 m2 |
| 29 |
3 m3 |
| 30 |
4 m4 |
| 31 |
SELECT * FROM t2 ORDER BY a; |
| 32 |
a b |
| 33 |
1 i1 |
| 34 |
2 i2 |
| 35 |
3 i3 |
| 36 |
4 i4 |
| 37 |
connection server_3; |
| 38 |
SELECT * FROM t1 ORDER BY a; |
| 39 |
a b |
| 40 |
1 m1 |
| 41 |
2 m2 |
| 42 |
3 m3 |
| 43 |
4 m4 |
| 44 |
SELECT * FROM t2 ORDER BY a; |
| 45 |
a b |
| 46 |
1 i1 |
| 47 |
2 i2 |
| 48 |
3 i3 |
| 49 |
4 i4 |
| 50 |
connection server_4; |
| 51 |
SELECT * FROM t1 ORDER BY a; |
| 52 |
a b |
| 53 |
1 m1 |
| 54 |
2 m2 |
| 55 |
3 m3 |
| 56 |
4 m4 |
| 57 |
SELECT * FROM t2 ORDER BY a; |
| 58 |
a b |
| 59 |
1 i1 |
| 60 |
2 i2 |
| 61 |
3 i3 |
| 62 |
4 i4 |
| 63 |
*** Now take out D, let it fall behind a bit, and then test re-attaching it to A *** |
| 64 |
connection server_4; |
| 65 |
include/stop_slave.inc |
| 66 |
connection server_1; |
| 67 |
INSERT INTO t1 VALUES (5, "m1a"); |
| 68 |
INSERT INTO t2 VALUES (5, "i1a"); |
| 69 |
connection server_4; |
| 70 |
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT, |
| 71 |
MASTER_USE_GTID=CURRENT_POS; |
| 72 |
include/start_slave.inc |
| 73 |
SELECT * FROM t1 ORDER BY a; |
| 74 |
a b |
| 75 |
1 m1 |
| 76 |
2 m2 |
| 77 |
3 m3 |
| 78 |
4 m4 |
| 79 |
5 m1a |
| 80 |
SELECT * FROM t2 ORDER BY a; |
| 81 |
a b |
| 82 |
1 i1 |
| 83 |
2 i2 |
| 84 |
3 i3 |
| 85 |
4 i4 |
| 86 |
5 i1a |
| 87 |
*** Now move B to D (C is still replicating from B) *** |
| 88 |
connection server_2; |
| 89 |
include/stop_slave.inc |
| 90 |
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_4, |
| 91 |
MASTER_USE_GTID=CURRENT_POS; |
| 92 |
include/start_slave.inc |
| 93 |
connection server_4; |
| 94 |
UPDATE t2 SET b="j1a" WHERE a=5; |
| 95 |
connection server_2; |
| 96 |
SELECT * FROM t1 ORDER BY a; |
| 97 |
a b |
| 98 |
1 m1 |
| 99 |
2 m2 |
| 100 |
3 m3 |
| 101 |
4 m4 |
| 102 |
5 m1a |
| 103 |
SELECT * FROM t2 ORDER BY a; |
| 104 |
a b |
| 105 |
1 i1 |
| 106 |
2 i2 |
| 107 |
3 i3 |
| 108 |
4 i4 |
| 109 |
5 j1a |
| 110 |
*** Now move C to D, after letting it fall a little behind *** |
| 111 |
connection server_3; |
| 112 |
include/stop_slave.inc |
| 113 |
connection server_1; |
| 114 |
INSERT INTO t2 VALUES (6, "i6b"); |
| 115 |
INSERT INTO t2 VALUES (7, "i7b"); |
| 116 |
include/save_master_gtid.inc |
| 117 |
connection server_3; |
| 118 |
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_4, |
| 119 |
MASTER_USE_GTID=CURRENT_POS; |
| 120 |
include/start_slave.inc |
| 121 |
include/sync_with_master_gtid.inc |
| 122 |
SELECT * FROM t2 ORDER BY a; |
| 123 |
a b |
| 124 |
1 i1 |
| 125 |
2 i2 |
| 126 |
3 i3 |
| 127 |
4 i4 |
| 128 |
5 j1a |
| 129 |
6 i6b |
| 130 |
7 i7b |
| 131 |
*** Now change everything back to what it was, to make rpl_end.inc happy |
| 132 |
connection server_2; |
| 133 |
include/sync_with_master_gtid.inc |
| 134 |
include/stop_slave.inc |
| 135 |
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_MYPORT; |
| 136 |
include/start_slave.inc |
| 137 |
include/wait_for_slave_to_start.inc |
| 138 |
connection server_3; |
| 139 |
include/stop_slave.inc |
| 140 |
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SLAVE_MYPORT; |
| 141 |
include/start_slave.inc |
| 142 |
include/sync_with_master_gtid.inc |
| 143 |
connection server_4; |
| 144 |
include/stop_slave.inc |
| 145 |
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_3; |
| 146 |
include/start_slave.inc |
| 147 |
connection server_1; |
| 148 |
DROP TABLE t1,t2; |
| 149 |
include/save_master_gtid.inc |
| 150 |
*** A few more checks for BINLOG_GTID_POS function *** |
| 151 |
SELECT BINLOG_GTID_POS(); |
| 152 |
ERROR 42000: Incorrect parameter count in the call to native function 'BINLOG_GTID_POS' |
| 153 |
SELECT BINLOG_GTID_POS('a'); |
| 154 |
ERROR 42000: Incorrect parameter count in the call to native function 'BINLOG_GTID_POS' |
| 155 |
SELECT BINLOG_GTID_POS('a',1,NULL); |
| 156 |
ERROR 42000: Incorrect parameter count in the call to native function 'BINLOG_GTID_POS' |
| 157 |
SELECT BINLOG_GTID_POS(1,'a'); |
| 158 |
BINLOG_GTID_POS(1,'a') |
| 159 |
NULL |
| 160 |
Warnings: |
| 161 |
Warning 1292 Truncated incorrect INTEGER value: 'a' |
| 162 |
SELECT BINLOG_GTID_POS(NULL,NULL); |
| 163 |
BINLOG_GTID_POS(NULL,NULL) |
| 164 |
NULL |
| 165 |
SELECT BINLOG_GTID_POS('',1); |
| 166 |
BINLOG_GTID_POS('',1) |
| 167 |
|
| 168 |
SELECT BINLOG_GTID_POS('a',1); |
| 169 |
BINLOG_GTID_POS('a',1) |
| 170 |
NULL |
| 171 |
SELECT BINLOG_GTID_POS('master-bin.000001',-1); |
| 172 |
BINLOG_GTID_POS('master-bin.000001',-1) |
| 173 |
NULL |
| 174 |
SELECT BINLOG_GTID_POS('master-bin.000001',0); |
| 175 |
BINLOG_GTID_POS('master-bin.000001',0) |
| 176 |
|
| 177 |
SELECT BINLOG_GTID_POS('master-bin.000001',18446744073709551615); |
| 178 |
BINLOG_GTID_POS('master-bin.000001',18446744073709551615) |
| 179 |
NULL |
| 180 |
SELECT BINLOG_GTID_POS('master-bin.000001',18446744073709551616); |
| 181 |
BINLOG_GTID_POS('master-bin.000001',18446744073709551616) |
| 182 |
NULL |
| 183 |
Warnings: |
| 184 |
Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated |
| 185 |
SET sql_log_bin= 0; |
| 186 |
CREATE TABLE t1 AS SELECT MASTER_POS_WAIT(@binlog_file, 4, 0); |
| 187 |
SELECT BINLOG_GTID_POS(@binlog_file, 4); |
| 188 |
BINLOG_GTID_POS(@binlog_file, 4) |
| 189 |
NULL |
| 190 |
DROP TABLE t1; |
| 191 |
SET sql_log_bin= 1; |
| 192 |
*** Some tests of @@GLOBAL.gtid_binlog_state *** |
| 193 |
connection server_2; |
| 194 |
include/sync_with_master_gtid.inc |
| 195 |
include/stop_slave.inc |
| 196 |
connection server_1; |
| 197 |
SET @old_state= @@GLOBAL.gtid_binlog_state; |
| 198 |
SET GLOBAL gtid_binlog_state = ''; |
| 199 |
ERROR HY000: This operation is not allowed if any GTID has been logged to the binary log. Run RESET MASTER first to erase the log |
| 200 |
RESET MASTER; |
| 201 |
SET GLOBAL gtid_binlog_state = ''; |
| 202 |
FLUSH LOGS; |
| 203 |
show binary logs; |
| 204 |
Log_name File_size |
| 205 |
master-bin.000001 # |
| 206 |
master-bin.000002 # |
| 207 |
SET GLOBAL gtid_binlog_state = '0-1-10,1-2-20,0-3-30'; |
| 208 |
show binary logs; |
| 209 |
Log_name File_size |
| 210 |
master-bin.000001 # |
| 211 |
include/show_binlog_events.inc |
| 212 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 213 |
master-bin.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION |
| 214 |
master-bin.000001 # Gtid_list # # [#-#-#] |
| 215 |
master-bin.000001 # Binlog_checkpoint # # master-bin.000001 |
| 216 |
SET GLOBAL gtid_binlog_state = @old_state; |
| 217 |
ERROR HY000: This operation is not allowed if any GTID has been logged to the binary log. Run RESET MASTER first to erase the log |
| 218 |
RESET MASTER; |
| 219 |
SET GLOBAL gtid_binlog_state = @old_state; |
| 220 |
CREATE TABLE t1 (a INT PRIMARY KEY); |
| 221 |
SET gtid_seq_no=100; |
| 222 |
INSERT INTO t1 VALUES (1); |
| 223 |
include/save_master_gtid.inc |
| 224 |
connection server_2; |
| 225 |
include/start_slave.inc |
| 226 |
include/sync_with_master_gtid.inc |
| 227 |
SELECT * FROM t1; |
| 228 |
a |
| 229 |
1 |
| 230 |
Gtid_IO_Pos = '0-1-100' |
| 231 |
*** Test @@LAST_GTID and MASTER_GTID_WAIT() *** |
| 232 |
connection server_1; |
| 233 |
DROP TABLE t1; |
| 234 |
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; |
| 235 |
connection server_2; |
| 236 |
include/stop_slave.inc |
| 237 |
connect m1,127.0.0.1,root,,test,$SERVER_MYPORT_1,; |
| 238 |
SELECT @@last_gtid; |
| 239 |
@@last_gtid |
| 240 |
|
| 241 |
SET gtid_seq_no=110; |
| 242 |
SELECT @@last_gtid; |
| 243 |
@@last_gtid |
| 244 |
|
| 245 |
BEGIN; |
| 246 |
SELECT @@last_gtid; |
| 247 |
@@last_gtid |
| 248 |
|
| 249 |
INSERT INTO t1 VALUES (2); |
| 250 |
SELECT @@last_gtid; |
| 251 |
@@last_gtid |
| 252 |
|
| 253 |
COMMIT; |
| 254 |
SELECT @@last_gtid; |
| 255 |
@@last_gtid |
| 256 |
0-1-110 |
| 257 |
connect s1,127.0.0.1,root,,test,$SERVER_MYPORT_2,; |
| 258 |
SET @pos= '0-1-110'; |
| 259 |
SELECT master_gtid_wait(NULL); |
| 260 |
master_gtid_wait(NULL) |
| 261 |
NULL |
| 262 |
SELECT master_gtid_wait('', NULL); |
| 263 |
master_gtid_wait('', NULL) |
| 264 |
0 |
| 265 |
SHOW STATUS LIKE 'Master_gtid_wait_count'; |
| 266 |
Variable_name Value |
| 267 |
Master_gtid_wait_count 1 |
| 268 |
SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; |
| 269 |
Variable_name Value |
| 270 |
Master_gtid_wait_timeouts 0 |
| 271 |
SHOW STATUS LIKE 'Master_gtid_wait_time'; |
| 272 |
Variable_name Value |
| 273 |
Master_gtid_wait_time 0 |
| 274 |
SELECT master_gtid_wait(@pos, 0.5); |
| 275 |
master_gtid_wait(@pos, 0.5) |
| 276 |
-1 |
| 277 |
SELECT * FROM t1 ORDER BY a; |
| 278 |
a |
| 279 |
SELECT master_gtid_wait(@pos); |
| 280 |
connection server_2; |
| 281 |
include/start_slave.inc |
| 282 |
connection s1; |
| 283 |
master_gtid_wait(@pos) |
| 284 |
0 |
| 285 |
SELECT * FROM t1 ORDER BY a; |
| 286 |
a |
| 287 |
2 |
| 288 |
include/stop_slave.inc |
| 289 |
connection server_1; |
| 290 |
SET gtid_domain_id= 1; |
| 291 |
INSERT INTO t1 VALUES (3); |
| 292 |
connection s1; |
| 293 |
SET @pos= 'POS'; |
| 294 |
SELECT master_gtid_wait(@pos, 0); |
| 295 |
master_gtid_wait(@pos, 0) |
| 296 |
-1 |
| 297 |
SELECT * FROM t1 WHERE a >= 3; |
| 298 |
a |
| 299 |
SELECT master_gtid_wait(@pos, -1); |
| 300 |
connection server_2; |
| 301 |
include/start_slave.inc |
| 302 |
connection s1; |
| 303 |
master_gtid_wait(@pos, -1) |
| 304 |
0 |
| 305 |
SELECT * FROM t1 WHERE a >= 3; |
| 306 |
a |
| 307 |
3 |
| 308 |
SELECT master_gtid_wait('1-1-1', 0); |
| 309 |
master_gtid_wait('1-1-1', 0) |
| 310 |
0 |
| 311 |
connection s1; |
| 312 |
SELECT master_gtid_wait('2-1-1,1-1-4,0-1-110'); |
| 313 |
connect s2,127.0.0.1,root,,test,$SERVER_MYPORT_2,; |
| 314 |
SELECT master_gtid_wait('0-1-1000', 0.5); |
| 315 |
connect s3,127.0.0.1,root,,test,$SERVER_MYPORT_2,; |
| 316 |
SELECT master_gtid_wait('0-1-2000'); |
| 317 |
connect s4,127.0.0.1,root,,test,$SERVER_MYPORT_2,; |
| 318 |
SELECT master_gtid_wait('2-1-10'); |
| 319 |
connect s5,127.0.0.1,root,,test,$SERVER_MYPORT_2,; |
| 320 |
SELECT master_gtid_wait('2-1-6', 1); |
| 321 |
connect s6,127.0.0.1,root,,test,$SERVER_MYPORT_2,; |
| 322 |
SELECT master_gtid_wait('2-1-5'); |
| 323 |
connect s7,127.0.0.1,root,,test,$SERVER_MYPORT_2,; |
| 324 |
SELECT master_gtid_wait('2-1-10'); |
| 325 |
connect s8,127.0.0.1,root,,test,$SERVER_MYPORT_2,; |
| 326 |
SELECT master_gtid_wait('2-1-5,1-1-4,0-1-110'); |
| 327 |
connect s9,127.0.0.1,root,,test,$SERVER_MYPORT_2,; |
| 328 |
SELECT master_gtid_wait('2-1-2'); |
| 329 |
connection server_2; |
| 330 |
SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; |
| 331 |
Variable_name Value |
| 332 |
Master_gtid_wait_timeouts 0 |
| 333 |
SHOW STATUS LIKE 'Master_gtid_wait_count'; |
| 334 |
Variable_name Value |
| 335 |
Master_gtid_wait_count 3 |
| 336 |
SELECT master_gtid_wait('1-1-1'); |
| 337 |
master_gtid_wait('1-1-1') |
| 338 |
0 |
| 339 |
SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; |
| 340 |
Variable_name Value |
| 341 |
Master_gtid_wait_timeouts 0 |
| 342 |
SHOW STATUS LIKE 'Master_gtid_wait_count'; |
| 343 |
Variable_name Value |
| 344 |
Master_gtid_wait_count 4 |
| 345 |
SET @a= MASTER_GTID_WAIT_TIME; |
| 346 |
SELECT IF(@a <= 100*1000*1000, "OK", CONCAT("Error: wait time ", @a, " is larger than expected")) |
| 347 |
AS Master_gtid_wait_time_as_expected; |
| 348 |
Master_gtid_wait_time_as_expected |
| 349 |
OK |
| 350 |
connect s10,127.0.0.1,root,,test,$SERVER_MYPORT_2,; |
| 351 |
SELECT master_gtid_wait('0-1-109'); |
| 352 |
connection server_2; |
| 353 |
SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; |
| 354 |
Variable_name Value |
| 355 |
Master_gtid_wait_timeouts 0 |
| 356 |
SHOW STATUS LIKE 'Master_gtid_wait_count'; |
| 357 |
Variable_name Value |
| 358 |
Master_gtid_wait_count 4 |
| 359 |
SELECT master_gtid_wait('2-1-2', 0.5); |
| 360 |
master_gtid_wait('2-1-2', 0.5) |
| 361 |
-1 |
| 362 |
SHOW STATUS LIKE 'Master_gtid_wait_timeouts'; |
| 363 |
Variable_name Value |
| 364 |
Master_gtid_wait_timeouts 1 |
| 365 |
SHOW STATUS LIKE 'Master_gtid_wait_count'; |
| 366 |
Variable_name Value |
| 367 |
Master_gtid_wait_count 5 |
| 368 |
SET @a= MASTER_GTID_WAIT_TIME; |
| 369 |
SELECT IF(@a BETWEEN 0.4*1000*1000 AND 100*1000*1000, "OK", CONCAT("Error: wait time ", @a, " not as expected")) AS Master_gtid_wait_time_as_expected; |
| 370 |
Master_gtid_wait_time_as_expected |
| 371 |
OK |
| 372 |
KILL QUERY KILL_ID; |
| 373 |
connection s3; |
| 374 |
ERROR 70100: Query execution was interrupted |
| 375 |
connection server_1; |
| 376 |
SET gtid_domain_id=2; |
| 377 |
SET gtid_seq_no=2; |
| 378 |
INSERT INTO t1 VALUES (4); |
| 379 |
connection s9; |
| 380 |
master_gtid_wait('2-1-2') |
| 381 |
0 |
| 382 |
connection server_2; |
| 383 |
KILL CONNECTION KILL_ID; |
| 384 |
connection s6; |
| 385 |
Got one of the listed errors |
| 386 |
connection server_1; |
| 387 |
SET gtid_domain_id=1; |
| 388 |
SET gtid_seq_no=4; |
| 389 |
INSERT INTO t1 VALUES (5); |
| 390 |
SET gtid_domain_id=2; |
| 391 |
SET gtid_seq_no=5; |
| 392 |
INSERT INTO t1 VALUES (6); |
| 393 |
connection s8; |
| 394 |
master_gtid_wait('2-1-5,1-1-4,0-1-110') |
| 395 |
0 |
| 396 |
connection s1; |
| 397 |
master_gtid_wait('2-1-1,1-1-4,0-1-110') |
| 398 |
0 |
| 399 |
connection s2; |
| 400 |
master_gtid_wait('0-1-1000', 0.5) |
| 401 |
-1 |
| 402 |
connection s5; |
| 403 |
master_gtid_wait('2-1-6', 1) |
| 404 |
-1 |
| 405 |
connection s10; |
| 406 |
master_gtid_wait('0-1-109') |
| 407 |
0 |
| 408 |
connection server_1; |
| 409 |
SET gtid_domain_id=2; |
| 410 |
SET gtid_seq_no=10; |
| 411 |
INSERT INTO t1 VALUES (7); |
| 412 |
connection s4; |
| 413 |
master_gtid_wait('2-1-10') |
| 414 |
0 |
| 415 |
connection s7; |
| 416 |
master_gtid_wait('2-1-10') |
| 417 |
0 |
| 418 |
*** Test gtid_slave_pos when used with GTID *** |
| 419 |
connection server_2; |
| 420 |
include/stop_slave.inc |
| 421 |
connection server_1; |
| 422 |
SET gtid_domain_id=2; |
| 423 |
SET gtid_seq_no=1000; |
| 424 |
INSERT INTO t1 VALUES (10); |
| 425 |
INSERT INTO t1 VALUES (11); |
| 426 |
connection server_2; |
| 427 |
SET sql_slave_skip_counter= 1; |
| 428 |
include/start_slave.inc |
| 429 |
SELECT * FROM t1 WHERE a >= 10 ORDER BY a; |
| 430 |
a |
| 431 |
11 |
| 432 |
SELECT IF(LOCATE("2-1-1001", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1001 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; |
| 433 |
status |
| 434 |
Ok |
| 435 |
include/stop_slave.inc |
| 436 |
connection server_1; |
| 437 |
SET gtid_domain_id=2; |
| 438 |
SET gtid_seq_no=1010; |
| 439 |
INSERT INTO t1 VALUES (12); |
| 440 |
INSERT INTO t1 VALUES (13); |
| 441 |
connection server_2; |
| 442 |
SET sql_slave_skip_counter= 2; |
| 443 |
include/start_slave.inc |
| 444 |
SELECT * FROM t1 WHERE a >= 10 ORDER BY a; |
| 445 |
a |
| 446 |
11 |
| 447 |
13 |
| 448 |
SELECT IF(LOCATE("2-1-1011", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1011 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; |
| 449 |
status |
| 450 |
Ok |
| 451 |
include/stop_slave.inc |
| 452 |
connection server_1; |
| 453 |
SET gtid_domain_id=2; |
| 454 |
SET gtid_seq_no=1020; |
| 455 |
INSERT INTO t1 VALUES (14); |
| 456 |
INSERT INTO t1 VALUES (15); |
| 457 |
INSERT INTO t1 VALUES (16); |
| 458 |
connection server_2; |
| 459 |
SET sql_slave_skip_counter= 3; |
| 460 |
include/start_slave.inc |
| 461 |
SELECT * FROM t1 WHERE a >= 10 ORDER BY a; |
| 462 |
a |
| 463 |
11 |
| 464 |
13 |
| 465 |
15 |
| 466 |
16 |
| 467 |
SELECT IF(LOCATE("2-1-1022", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1022 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; |
| 468 |
status |
| 469 |
Ok |
| 470 |
include/stop_slave.inc |
| 471 |
connection server_1; |
| 472 |
SET gtid_domain_id=2; |
| 473 |
SET gtid_seq_no=1030; |
| 474 |
SET @@binlog_annotate_row_events= 0; |
| 475 |
INSERT INTO t1 VALUES (17); |
| 476 |
INSERT INTO t1 VALUES (18); |
| 477 |
INSERT INTO t1 VALUES (19); |
| 478 |
SET @@binlog_annotate_row_events= 1; |
| 479 |
connection server_2; |
| 480 |
SET sql_slave_skip_counter= 5; |
| 481 |
include/start_slave.inc |
| 482 |
SELECT * FROM t1 WHERE a >= 10 ORDER BY a; |
| 483 |
a |
| 484 |
11 |
| 485 |
13 |
| 486 |
15 |
| 487 |
16 |
| 488 |
19 |
| 489 |
SELECT IF(LOCATE("2-1-1032", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1032 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; |
| 490 |
status |
| 491 |
Ok |
| 492 |
include/stop_slave.inc |
| 493 |
connection server_1; |
| 494 |
SET gtid_domain_id=3; |
| 495 |
SET gtid_seq_no=100; |
| 496 |
CREATE TABLE t2 (a INT PRIMARY KEY); |
| 497 |
DROP TABLE t2; |
| 498 |
SET gtid_domain_id=2; |
| 499 |
SET gtid_seq_no=1040; |
| 500 |
INSERT INTO t1 VALUES (20); |
| 501 |
connection server_2; |
| 502 |
SET @saved_mode= @@GLOBAL.slave_ddl_exec_mode; |
| 503 |
SET GLOBAL slave_ddl_exec_mode=STRICT; |
| 504 |
SET sql_slave_skip_counter=1; |
| 505 |
START SLAVE UNTIL master_gtid_pos="3-1-100"; |
| 506 |
include/sync_with_master_gtid.inc |
| 507 |
include/wait_for_slave_to_stop.inc |
| 508 |
SELECT * FROM t2; |
| 509 |
ERROR 42S02: Table 'test.t2' doesn't exist |
| 510 |
SELECT IF(LOCATE("3-1-100", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-100 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; |
| 511 |
status |
| 512 |
Ok |
| 513 |
SET sql_log_bin=0; |
| 514 |
CALL mtr.add_suppression("Slave: Unknown table 'test\\.t2' Error_code: 1051"); |
| 515 |
SET sql_log_bin=1; |
| 516 |
START SLAVE; |
| 517 |
include/wait_for_slave_sql_error.inc [errno=1051] |
| 518 |
SELECT IF(LOCATE("3-1-100", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-100 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; |
| 519 |
status |
| 520 |
Ok |
| 521 |
STOP SLAVE IO_THREAD; |
| 522 |
SET sql_slave_skip_counter=2; |
| 523 |
include/start_slave.inc |
| 524 |
SELECT * FROM t1 WHERE a >= 20 ORDER BY a; |
| 525 |
a |
| 526 |
20 |
| 527 |
SELECT IF(LOCATE("3-1-101", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 3-1-101 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; |
| 528 |
status |
| 529 |
Ok |
| 530 |
SELECT IF(LOCATE("2-1-1040", @@GLOBAL.gtid_slave_pos)>0, "Ok", CONCAT("ERROR! expected GTID 2-1-1040 not found in gtid_slave_pos: ", @@GLOBAL.gtid_slave_pos)) AS status; |
| 531 |
status |
| 532 |
Ok |
| 533 |
SET GLOBAL slave_ddl_exec_mode= @saved_mode; |
| 534 |
*** Test GTID-connecting to a master with out-of-order sequence numbers in the binlog. *** |
| 535 |
connection server_1; |
| 536 |
SET gtid_domain_id= @@GLOBAL.gtid_domain_id; |
| 537 |
INSERT INTO t1 VALUES (31); |
| 538 |
connection server_2; |
| 539 |
SET gtid_domain_id= @@GLOBAL.gtid_domain_id; |
| 540 |
INSERT INTO t1 VALUES (32); |
| 541 |
connection server_1; |
| 542 |
INSERT INTO t1 VALUES (33); |
| 543 |
connection server_2; |
| 544 |
connection server_3; |
| 545 |
include/stop_slave.inc |
| 546 |
connection server_1; |
| 547 |
INSERT INTO t1 VALUES (34); |
| 548 |
connection server_2; |
| 549 |
connection server_3; |
| 550 |
include/start_slave.inc |
| 551 |
SELECT * FROM t1 WHERE a >= 30 ORDER BY a; |
| 552 |
a |
| 553 |
31 |
| 554 |
32 |
| 555 |
33 |
| 556 |
34 |
| 557 |
connection server_4; |
| 558 |
SELECT * FROM t1 WHERE a >= 30 ORDER BY a; |
| 559 |
a |
| 560 |
31 |
| 561 |
32 |
| 562 |
33 |
| 563 |
34 |
| 564 |
*** MDEV-31723: Crash on SET SESSION gtid_seq_no= DEFAULT |
| 565 |
connection server_1; |
| 566 |
SET SESSION gtid_seq_no= 2000; |
| 567 |
SELECT @@SESSION.gtid_seq_no; |
| 568 |
@@SESSION.gtid_seq_no |
| 569 |
2000 |
| 570 |
INSERT INTO t1 VALUES (40); |
| 571 |
SELECT @@SESSION.gtid_seq_no; |
| 572 |
@@SESSION.gtid_seq_no |
| 573 |
0 |
| 574 |
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos; |
| 575 |
dom0_pos |
| 576 |
0-1-2000 |
| 577 |
INSERT INTO t1 VALUES (41); |
| 578 |
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos; |
| 579 |
dom0_pos |
| 580 |
0-1-2001 |
| 581 |
SET SESSION gtid_seq_no= 2010; |
| 582 |
INSERT INTO t1 VALUES (42); |
| 583 |
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos; |
| 584 |
dom0_pos |
| 585 |
0-1-2010 |
| 586 |
SET @old_strict= @@GLOBAL.gtid_strict_mode; |
| 587 |
SET GLOBAL gtid_strict_mode= 1; |
| 588 |
SET SESSION gtid_seq_no= 0; |
| 589 |
INSERT INTO t1 VALUES (43); |
| 590 |
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos; |
| 591 |
dom0_pos |
| 592 |
0-1-2011 |
| 593 |
SET GLOBAL gtid_strict_mode= @old_strict; |
| 594 |
INSERT INTO t1 VALUES (44); |
| 595 |
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos; |
| 596 |
dom0_pos |
| 597 |
0-1-2012 |
| 598 |
SET SESSION gtid_seq_no= 2020; |
| 599 |
SET SESSION gtid_seq_no= 2030; |
| 600 |
INSERT INTO t1 VALUES (45); |
| 601 |
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos; |
| 602 |
dom0_pos |
| 603 |
0-1-2030 |
| 604 |
SET SESSION gtid_seq_no= 2040; |
| 605 |
SET SESSION gtid_seq_no= DEFAULT; |
| 606 |
INSERT INTO t1 VALUES (46); |
| 607 |
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos; |
| 608 |
dom0_pos |
| 609 |
0-1-2031 |
| 610 |
INSERT INTO t1 VALUES (47); |
| 611 |
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos; |
| 612 |
dom0_pos |
| 613 |
0-1-2032 |
| 614 |
SET SESSION gtid_seq_no= 2050; |
| 615 |
SET SESSION gtid_seq_no= 0; |
| 616 |
INSERT INTO t1 VALUES (48); |
| 617 |
SELECT REGEXP_REPLACE(@@gtid_binlog_pos, ".*\\b(0-1-[0-9]+)\\b.*", "\\1") AS dom0_pos; |
| 618 |
dom0_pos |
| 619 |
0-1-2033 |
| 620 |
connection server_1; |
| 621 |
DROP TABLE t1; |
| 622 |
include/rpl_end.inc |
| 623 |
# |
| 624 |
# Start of 10.2 tests |
| 625 |
# |
| 626 |
# |
| 627 |
# MDEV-10134 Add full support for DEFAULT |
| 628 |
# |
| 629 |
CREATE TABLE t1 (a VARCHAR(100) DEFAULT BINLOG_GTID_POS("master-bin.000001", 600)); |
| 630 |
ERROR HY000: Function or expression 'binlog_gtid_pos()' cannot be used in the DEFAULT clause of `a` |
| 631 |
# |
| 632 |
# End of 10.2 tests |
| 633 |
# |
| 634 |
# |
| 635 |
# Start of 10.3 tests |
| 636 |
# |
| 637 |
# |
| 638 |
# MDEV-13967 Parameter data type control for Item_long_func |
| 639 |
# |
| 640 |
SELECT MASTER_GTID_WAIT(ROW(1,1),'str'); |
| 641 |
ERROR HY000: Illegal parameter data type row for operation 'master_gtid_wait' |
| 642 |
SELECT MASTER_GTID_WAIT('str',ROW(1,1)); |
| 643 |
ERROR HY000: Illegal parameter data type row for operation 'master_gtid_wait' |
| 644 |
# |
| 645 |
# End of 10.3 tests |
| 646 |
# |