From 5fc2814698bdac10fddcc5db4a42c971471dd4f5 Mon Sep 17 00:00:00 2001 From: Kristian Nielsen Date: Tue, 2 Dec 2014 18:11:05 +0100 Subject: [PATCH] MDEV-7251: Test failure in rpl.rpl_parallel There was a race. The test case was expecting the slave to start processing a particular DELETE statement, then the test would stop the slave at this point. But there was missing something to wait until the slave would actually reach this point; thus depending on timing it was possible that the slave would be stopped too early, causing .result file difference. Fixed by adding an appropriate wait to the test case. --- mysql-test/suite/rpl/r/rpl_parallel.result | 3 +++ mysql-test/suite/rpl/t/rpl_parallel.test | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/mysql-test/suite/rpl/r/rpl_parallel.result b/mysql-test/suite/rpl/r/rpl_parallel.result index e1672872386..a3b423a49c9 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel.result +++ b/mysql-test/suite/rpl/r/rpl_parallel.result @@ -983,7 +983,10 @@ SET GLOBAL slave_parallel_threads=0; SET GLOBAL slave_parallel_threads=10; INSERT INTO t2 VALUES (41); INSERT INTO t2 VALUES (42); +SET @old_format= @@binlog_format; +SET binlog_format= statement; DELETE FROM t2 WHERE a=40; +SET binlog_format= @old_format; INSERT INTO t2 VALUES (43); INSERT INTO t2 VALUES (44); FLUSH LOGS; diff --git a/mysql-test/suite/rpl/t/rpl_parallel.test b/mysql-test/suite/rpl/t/rpl_parallel.test index b1b8792acf6..a56d45848a5 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel.test +++ b/mysql-test/suite/rpl/t/rpl_parallel.test @@ -1560,7 +1560,11 @@ SET GLOBAL slave_parallel_threads=10; # Setup some transaction for the slave to replicate. INSERT INTO t2 VALUES (41); INSERT INTO t2 VALUES (42); +# Need to log the DELETE in statement format, so we can see it in processlist. +SET @old_format= @@binlog_format; +SET binlog_format= statement; DELETE FROM t2 WHERE a=40; +SET binlog_format= @old_format; INSERT INTO t2 VALUES (43); INSERT INTO t2 VALUES (44); # Force the slave to switch to a new relay log file. @@ -1581,6 +1585,11 @@ SELECT * FROM t2 WHERE a=40 FOR UPDATE; --connection server_2 --source include/start_slave.inc +# Wait for a worker thread to start on the DELETE that will be blocked +# temporarily by the SELECT FOR UPDATE. +--let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist WHERE state='updating' and info LIKE '%DELETE FROM t2 WHERE a=40%' +--source include/wait_condition.inc + # The DBUG injection set above will make the worker thread signal the following # debug_sync when the GTID 0-1-100 has been reached by a worker thread. # Thus, at this point, the SQL driver thread has reached the next