Skip to content

Commit 343ba58

Browse files
committed
MDEV-10631 rpl.rpl_mdev6386 failed in buildbot
The failure happens due to a race condition between processing a row event (INSERT) and an automatically generated event DROP TEMPORARY TABLE. Even though DROP has a higher GTID, it can become visible in @@gtid_slave_pos before the row event with a lower GTID has been committed. Since the test makes the slave to synchronize with the master using GTID, the waiting stops as soon as GTID of the DROP TEMPORARY TABLE becomes visible, and if changes from the previous event haven't been applied yet, the error occurs. According to Kristian (see the comment to MDEV-10631), the real problem is that DROP TEMPORARY TABLE is logged in the row mode at all. For this particular test, since DROP does not do anything, nothing prevents it from competing with the prior transaction. The workaround for the test is to add a meaningful event after DROP TEMPORARY TABLE, so that the slave would wait on its GTID instead of the one from DROP. Additionally (unrelated to this problem) removed FLUSH TABLES, which, as the comment stated, should have been removed after MDEV-6403 was fixed.
1 parent 72a822f commit 343ba58

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
include/master-slave.inc
22
[connection master]
33
ALTER TABLE mysql.gtid_slave_pos ENGINE = InnoDB;
4-
FLUSH LOGS;
54
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) Engine=InnoDB;
65
include/stop_slave.inc
76
SET sql_log_bin= 0;
@@ -22,6 +21,7 @@ INSERT INTO t2 VALUE (4, 1);
2221
INSERT INTO t2 VALUE (5, 1);
2322
INSERT INTO t1 SELECT * FROM t2;
2423
DROP TEMPORARY TABLE t2;
24+
INSERT INTO t1 VALUE (6, 3);
2525
include/save_master_gtid.inc
2626
Contents on master:
2727
SELECT * FROM t1 ORDER BY a;
@@ -31,6 +31,7 @@ a b
3131
3 1
3232
4 1
3333
5 1
34+
6 3
3435
START SLAVE;
3536
include/wait_for_slave_sql_error.inc [errno=1062]
3637
STOP SLAVE IO_THREAD;
@@ -51,6 +52,7 @@ a b
5152
3 1
5253
4 1
5354
5 1
55+
6 3
5456
DROP TABLE t1;
5557
include/stop_slave.inc
5658
SET GLOBAL slave_parallel_threads= @old_parallel;

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
--source include/master-slave.inc
33

44
--connection master
5-
# ToDo: Remove this FLUSH LOGS when MDEV-6403 is fixed.
65
ALTER TABLE mysql.gtid_slave_pos ENGINE = InnoDB;
7-
FLUSH LOGS;
86
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) Engine=InnoDB;
97
--sync_slave_with_master
108

@@ -31,6 +29,7 @@ INSERT INTO t2 VALUE (4, 1);
3129
INSERT INTO t2 VALUE (5, 1);
3230
INSERT INTO t1 SELECT * FROM t2;
3331
DROP TEMPORARY TABLE t2;
32+
INSERT INTO t1 VALUE (6, 3);
3433
--source include/save_master_gtid.inc
3534
--echo Contents on master:
3635
SELECT * FROM t1 ORDER BY a;

0 commit comments

Comments
 (0)