Skip to content

Commit

Permalink
MDEV-10631 rpl.rpl_mdev6386 failed in buildbot
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
elenst committed Feb 19, 2017
1 parent 72a822f commit 343ba58
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 3 additions & 1 deletion mysql-test/suite/rpl/r/rpl_mdev6386.result
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
include/master-slave.inc
[connection master]
ALTER TABLE mysql.gtid_slave_pos ENGINE = InnoDB;
FLUSH LOGS;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) Engine=InnoDB;
include/stop_slave.inc
SET sql_log_bin= 0;
Expand All @@ -22,6 +21,7 @@ INSERT INTO t2 VALUE (4, 1);
INSERT INTO t2 VALUE (5, 1);
INSERT INTO t1 SELECT * FROM t2;
DROP TEMPORARY TABLE t2;
INSERT INTO t1 VALUE (6, 3);
include/save_master_gtid.inc
Contents on master:
SELECT * FROM t1 ORDER BY a;
Expand All @@ -31,6 +31,7 @@ a b
3 1
4 1
5 1
6 3
START SLAVE;
include/wait_for_slave_sql_error.inc [errno=1062]
STOP SLAVE IO_THREAD;
Expand All @@ -51,6 +52,7 @@ a b
3 1
4 1
5 1
6 3
DROP TABLE t1;
include/stop_slave.inc
SET GLOBAL slave_parallel_threads= @old_parallel;
Expand Down
3 changes: 1 addition & 2 deletions mysql-test/suite/rpl/t/rpl_mdev6386.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
--source include/master-slave.inc

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

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

0 comments on commit 343ba58

Please sign in to comment.