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:
@@ -57,6 +57,7 @@ include/stop_slave.inc
|
||||
RESET MASTER;
|
||||
INSERT INTO t1 VALUES (2);
|
||||
INSERT INTO t1 VALUES (4);
|
||||
include/save_master_gtid.inc
|
||||
SET sql_log_bin = 0;
|
||||
INSERT INTO t1 VALUES (2);
|
||||
SET sql_log_bin = 1;
|
||||
@@ -84,6 +85,7 @@ Warning 1948 Specified value for @@gtid_slave_pos contains no value for replicat
|
||||
RESET MASTER;
|
||||
SET GLOBAL gtid_slave_pos = "0-1-1";
|
||||
START SLAVE;
|
||||
include/sync_with_master_gtid.inc
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a
|
||||
1
|
||||
@@ -93,6 +95,7 @@ a
|
||||
*** MDEV-4688: Empty value of @@GLOBAL.gtid_slave_pos ***
|
||||
include/stop_slave.inc
|
||||
INSERT INTO t1 VALUES (5);
|
||||
include/save_master_gtid.inc
|
||||
SET @old_dbug= @@GLOBAL.debug_dbug;
|
||||
SET GLOBAL debug_dbug="+d,dummy_disable_default_dbug_output";
|
||||
SET GLOBAL debug_dbug="+d,gtid_fail_after_record_gtid";
|
||||
@@ -112,6 +115,7 @@ a
|
||||
4
|
||||
SET GLOBAL debug_dbug= @old_dbug;
|
||||
START SLAVE SQL_THREAD;
|
||||
include/sync_with_master_gtid.inc
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a
|
||||
1
|
||||
@@ -136,6 +140,8 @@ SET GLOBAL gtid_slave_pos = "0-1-3";
|
||||
START SLAVE;
|
||||
include/wait_for_slave_to_start.inc
|
||||
INSERT INTO t1 VALUES (6);
|
||||
include/save_master_gtid.inc
|
||||
include/sync_with_master_gtid.inc
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a
|
||||
1
|
||||
|
Reference in New Issue
Block a user