From 343ba58562ace1edd2bb24aeb31aabffcae5fec2 Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Sat, 18 Feb 2017 16:33:18 +0200 Subject: 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. --- mysql-test/suite/rpl/r/rpl_mdev6386.result | 4 +++- mysql-test/suite/rpl/t/rpl_mdev6386.test | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/rpl/r/rpl_mdev6386.result b/mysql-test/suite/rpl/r/rpl_mdev6386.result index fa49d9a9c03..c8bd6f51822 100644 --- a/mysql-test/suite/rpl/r/rpl_mdev6386.result +++ b/mysql-test/suite/rpl/r/rpl_mdev6386.result @@ -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; @@ -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; @@ -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; @@ -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; diff --git a/mysql-test/suite/rpl/t/rpl_mdev6386.test b/mysql-test/suite/rpl/t/rpl_mdev6386.test index 3e4e79ea5a3..e85b1ae0132 100644 --- a/mysql-test/suite/rpl/t/rpl_mdev6386.test +++ b/mysql-test/suite/rpl/t/rpl_mdev6386.test @@ -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 @@ -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; -- cgit v1.2.1