Skip to content

Commit 553a4d6

Browse files
committed
MDEV-33602: Sporadic test failure in rpl.rpl_gtid_stop_start
The test could fail with a duplicate key error because switching to non-GTID mode could start at the wrong old-style position. The position could be wrong when the previous GTID connect was stopped before receiving the fake GTID list event which gives the old-style position corresponding to the GTID connected position. Work-around by injecting an extra event and syncing the slave before switching to non-GTID mode. Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
1 parent a1c1f50 commit 553a4d6

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

mysql-test/suite/rpl/r/rpl_gtid_stop_start.result

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ a
112112
6
113113
7
114114
*** MDEV-4486: Allow to start old-style replication even if mysql.gtid_slave_pos is unavailable
115+
connection server_1;
116+
INSERT INTO t1 VALUES (8);
117+
DELETE FROM t1 WHERE a=8;
118+
connection server_2;
115119
connection server_2;
116120
include/stop_slave.inc
117121
CHANGE MASTER TO master_use_gtid= no;

mysql-test/suite/rpl/t/rpl_gtid_stop_start.test

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,24 @@ SELECT * FROM t1 ORDER BY a;
170170

171171
--echo *** MDEV-4486: Allow to start old-style replication even if mysql.gtid_slave_pos is unavailable
172172

173+
# In GTID mode, the old-style replication position is also updated. But during
174+
# GTID connect, the old-style position is not known until receiving the fake
175+
# GTID list event, which contains the required position value. If we happened
176+
# to stop the slave above before this fake GTID list event, the test could fail
177+
# with duplicate key errors due to switching to non-GTID mode at a wrong
178+
# position too far back in the binlog.
179+
#
180+
# Work-around this by injecting an extra dummt event and syncing the slave to
181+
# it, ensuring the old-style position will be updated.
182+
#
183+
# This work-around could be removed after MDEV-33996 is fixed.
184+
--connection server_1
185+
INSERT INTO t1 VALUES (8);
186+
DELETE FROM t1 WHERE a=8;
187+
--save_master_pos
188+
--connection server_2
189+
--sync_with_master
190+
173191
--connection server_2
174192
--source include/stop_slave.inc
175193
CHANGE MASTER TO master_use_gtid= no;

0 commit comments

Comments
 (0)