Skip to content

Commit

Permalink
MDEV-33602: Sporadic test failure in rpl.rpl_gtid_stop_start
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
knielsen committed Apr 25, 2024
1 parent a1c1f50 commit 553a4d6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mysql-test/suite/rpl/r/rpl_gtid_stop_start.result
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ a
6
7
*** MDEV-4486: Allow to start old-style replication even if mysql.gtid_slave_pos is unavailable
connection server_1;
INSERT INTO t1 VALUES (8);
DELETE FROM t1 WHERE a=8;
connection server_2;
connection server_2;
include/stop_slave.inc
CHANGE MASTER TO master_use_gtid= no;
Expand Down
18 changes: 18 additions & 0 deletions mysql-test/suite/rpl/t/rpl_gtid_stop_start.test
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,24 @@ SELECT * FROM t1 ORDER BY a;

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

# In GTID mode, the old-style replication position is also updated. But during
# GTID connect, the old-style position is not known until receiving the fake
# GTID list event, which contains the required position value. If we happened
# to stop the slave above before this fake GTID list event, the test could fail
# with duplicate key errors due to switching to non-GTID mode at a wrong
# position too far back in the binlog.
#
# Work-around this by injecting an extra dummt event and syncing the slave to
# it, ensuring the old-style position will be updated.
#
# This work-around could be removed after MDEV-33996 is fixed.
--connection server_1
INSERT INTO t1 VALUES (8);
DELETE FROM t1 WHERE a=8;
--save_master_pos
--connection server_2
--sync_with_master

--connection server_2
--source include/stop_slave.inc
CHANGE MASTER TO master_use_gtid= no;
Expand Down

0 comments on commit 553a4d6

Please sign in to comment.