Commit 343ba585 authored by Elena Stepanova's avatar Elena Stepanova

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.
parent 72a822f2
include/master-slave.inc include/master-slave.inc
[connection master] [connection master]
ALTER TABLE mysql.gtid_slave_pos ENGINE = InnoDB; ALTER TABLE mysql.gtid_slave_pos ENGINE = InnoDB;
FLUSH LOGS;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) Engine=InnoDB; CREATE TABLE t1 (a INT PRIMARY KEY, b INT) Engine=InnoDB;
include/stop_slave.inc include/stop_slave.inc
SET sql_log_bin= 0; SET sql_log_bin= 0;
...@@ -22,6 +21,7 @@ INSERT INTO t2 VALUE (4, 1); ...@@ -22,6 +21,7 @@ INSERT INTO t2 VALUE (4, 1);
INSERT INTO t2 VALUE (5, 1); INSERT INTO t2 VALUE (5, 1);
INSERT INTO t1 SELECT * FROM t2; INSERT INTO t1 SELECT * FROM t2;
DROP TEMPORARY TABLE t2; DROP TEMPORARY TABLE t2;
INSERT INTO t1 VALUE (6, 3);
include/save_master_gtid.inc include/save_master_gtid.inc
Contents on master: Contents on master:
SELECT * FROM t1 ORDER BY a; SELECT * FROM t1 ORDER BY a;
...@@ -31,6 +31,7 @@ a b ...@@ -31,6 +31,7 @@ a b
3 1 3 1
4 1 4 1
5 1 5 1
6 3
START SLAVE; START SLAVE;
include/wait_for_slave_sql_error.inc [errno=1062] include/wait_for_slave_sql_error.inc [errno=1062]
STOP SLAVE IO_THREAD; STOP SLAVE IO_THREAD;
...@@ -51,6 +52,7 @@ a b ...@@ -51,6 +52,7 @@ a b
3 1 3 1
4 1 4 1
5 1 5 1
6 3
DROP TABLE t1; DROP TABLE t1;
include/stop_slave.inc include/stop_slave.inc
SET GLOBAL slave_parallel_threads= @old_parallel; SET GLOBAL slave_parallel_threads= @old_parallel;
......
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
--source include/master-slave.inc --source include/master-slave.inc
--connection master --connection master
# ToDo: Remove this FLUSH LOGS when MDEV-6403 is fixed.
ALTER TABLE mysql.gtid_slave_pos ENGINE = InnoDB; ALTER TABLE mysql.gtid_slave_pos ENGINE = InnoDB;
FLUSH LOGS;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) Engine=InnoDB; CREATE TABLE t1 (a INT PRIMARY KEY, b INT) Engine=InnoDB;
--sync_slave_with_master --sync_slave_with_master
...@@ -31,6 +29,7 @@ INSERT INTO t2 VALUE (4, 1); ...@@ -31,6 +29,7 @@ INSERT INTO t2 VALUE (4, 1);
INSERT INTO t2 VALUE (5, 1); INSERT INTO t2 VALUE (5, 1);
INSERT INTO t1 SELECT * FROM t2; INSERT INTO t1 SELECT * FROM t2;
DROP TEMPORARY TABLE t2; DROP TEMPORARY TABLE t2;
INSERT INTO t1 VALUE (6, 3);
--source include/save_master_gtid.inc --source include/save_master_gtid.inc
--echo Contents on master: --echo Contents on master:
SELECT * FROM t1 ORDER BY a; SELECT * FROM t1 ORDER BY a;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment