mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-4726: Race in mysql-test/suite/rpl/t/rpl_gtid_stop_start.test
Some GTID test cases were using include/wait_condition.inc with a condition like SELECT COUNT(*)=4 FROM t1 to wait for the slave to catch up with the master. This causes races and test failures, as the changes to the tables become visible at the COMMIT of the SQL thread (or even before in case of MyISAM), but the changes to @@gtid_slave_pos only become visible a little bit after the COMMIT. Now that we have MASTER_GTID_WAIT(), just use that to sync up in a GTID-friendly way, wrapped in nice include/save_master_gtid.inc and include/sync_with_master_gtid.inc scripts.
This commit is contained in:
@@ -103,9 +103,11 @@ BEGIN;
|
||||
INSERT INTO t2 VALUES (6, "i6b");
|
||||
INSERT INTO t2 VALUES (7, "i7b");
|
||||
COMMIT;
|
||||
include/save_master_gtid.inc
|
||||
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_4,
|
||||
MASTER_USE_GTID=CURRENT_POS;
|
||||
include/start_slave.inc
|
||||
include/sync_with_master_gtid.inc
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
a b
|
||||
1 i1
|
||||
@@ -116,6 +118,7 @@ a b
|
||||
6 i6b
|
||||
7 i7b
|
||||
*** Now change everything back to what it was, to make rpl_end.inc happy
|
||||
include/sync_with_master_gtid.inc
|
||||
include/stop_slave.inc
|
||||
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_MYPORT;
|
||||
include/start_slave.inc
|
||||
@@ -123,6 +126,7 @@ include/wait_for_slave_to_start.inc
|
||||
include/stop_slave.inc
|
||||
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SLAVE_MYPORT;
|
||||
include/start_slave.inc
|
||||
include/sync_with_master_gtid.inc
|
||||
include/stop_slave.inc
|
||||
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_3;
|
||||
include/start_slave.inc
|
||||
@@ -196,6 +200,7 @@ SET GLOBAL gtid_binlog_state = @old_state;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY);
|
||||
SET gtid_seq_no=100;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
include/save_master_gtid.inc
|
||||
include/start_slave.inc
|
||||
include/sync_with_master_gtid.inc
|
||||
SELECT * FROM t1;
|
||||
|
Reference in New Issue
Block a user