From 50b42441a666a53e466049845d779c2dca4f11c8 Mon Sep 17 00:00:00 2001 From: Kristian Nielsen Date: Tue, 2 Dec 2014 09:27:22 +0100 Subject: [PATCH] MDEV-7241: rpl.rpl_parallel2 fails sporadically in buildbot There was a race, a small window between updating slave position and updating Seconds_Behind_Master, during which the test case could see the wrong value. Fix by waiting for the expected status to appear. --- mysql-test/suite/rpl/r/rpl_parallel2.result | 1 + mysql-test/suite/rpl/t/rpl_parallel2.test | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/mysql-test/suite/rpl/r/rpl_parallel2.result b/mysql-test/suite/rpl/r/rpl_parallel2.result index 49be484f419..8bf8b9caf3b 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel2.result +++ b/mysql-test/suite/rpl/r/rpl_parallel2.result @@ -9,6 +9,7 @@ CALL mtr.add_suppression("Unsafe statement written to the binary log using state INSERT INTO t1 VALUES (1,sleep(2)); Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. +include/wait_for_slave_param.inc [Seconds_Behind_Master] Seconds_Behind_Master should be zero here because the slave is fully caught up and idle. Seconds_Behind_Master = '0' include/stop_slave.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel2.test b/mysql-test/suite/rpl/t/rpl_parallel2.test index 39b35063c7c..51c9e39a26a 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel2.test +++ b/mysql-test/suite/rpl/t/rpl_parallel2.test @@ -25,6 +25,13 @@ INSERT INTO t1 VALUES (1,sleep(2)); --connection server_2 --sync_with_master +# The slave position (which --sync_with_master waits for) is updated just +# before the Seconds_Behind_Master. So we have to wait for the zero status +# to appear, otherwise there is a small window between --sync_with_master +# and SHOW SLAVE STATUS where we can see a non-zero value. +--let $slave_param= Seconds_Behind_Master +--let $slave_param_value= 0 +--source include/wait_for_slave_param.inc --echo Seconds_Behind_Master should be zero here because the slave is fully caught up and idle. --let $status_items= Seconds_Behind_Master --source include/show_slave_status.inc