From 9c0b9f22661746ff0b62e2bb4a135941d7b145bf Mon Sep 17 00:00:00 2001 From: "ramil/ram@mysql.com/ramil.myoffice.izhnet.ru" <> Date: Tue, 19 Jun 2007 16:06:11 +0500 Subject: [PATCH] Fix for bug #28772: rpl_row_until fails in pushbuild Problem: we use 'sleep 2; wait_for_slave_to_stop;' to reach some slave's states which is buggy, wasteful of time, platform dependant etc. Fix: use include/wait_for_slave_***.inc's where it's possible instead. --- mysql-test/include/wait_for_slave_io_to_stop.inc | 2 +- mysql-test/include/wait_for_slave_sql_to_stop.inc | 6 +++--- mysql-test/include/wait_for_slave_to_start.inc | 2 +- mysql-test/include/wait_for_slave_to_stop.inc | 2 +- mysql-test/t/rpl_row_until.test | 12 ++++-------- mysql-test/t/rpl_stm_until.test | 12 ++++-------- 6 files changed, 14 insertions(+), 22 deletions(-) diff --git a/mysql-test/include/wait_for_slave_io_to_stop.inc b/mysql-test/include/wait_for_slave_io_to_stop.inc index 004f8bbbd8d..6e66d4e7521 100644 --- a/mysql-test/include/wait_for_slave_io_to_stop.inc +++ b/mysql-test/include/wait_for_slave_io_to_stop.inc @@ -25,7 +25,7 @@ while ($run) sleep 0.1; if (!$counter){ --echo "Failed while waiting for slave IO thread to stop" - SHOW SLAVE STATUS; + query_vertical SHOW SLAVE STATUS; exit; } dec $counter; diff --git a/mysql-test/include/wait_for_slave_sql_to_stop.inc b/mysql-test/include/wait_for_slave_sql_to_stop.inc index ee765c81f6a..7f435142901 100644 --- a/mysql-test/include/wait_for_slave_sql_to_stop.inc +++ b/mysql-test/include/wait_for_slave_sql_to_stop.inc @@ -22,9 +22,9 @@ while ($run) } sleep 0.1; if (!$counter){ - --echo "Failed while waiting for slave SQL thread to stop" - SHOW SLAVE STATUS; - exit; + --echo "Failed while waiting for slave SQL thread to stop" + query_vertical SHOW SLAVE STATUS; + exit; } dec $counter; } diff --git a/mysql-test/include/wait_for_slave_to_start.inc b/mysql-test/include/wait_for_slave_to_start.inc index 84e1d646efe..29d87b58a3c 100644 --- a/mysql-test/include/wait_for_slave_to_start.inc +++ b/mysql-test/include/wait_for_slave_to_start.inc @@ -26,7 +26,7 @@ while ($run) sleep 0.1; if (!$counter){ --echo "Failed while waiting for slave to start" - SHOW SLAVE STATUS; + query_vertical SHOW SLAVE STATUS; exit; } dec $counter; diff --git a/mysql-test/include/wait_for_slave_to_stop.inc b/mysql-test/include/wait_for_slave_to_stop.inc index 13acbecb835..95e0ac67dd5 100644 --- a/mysql-test/include/wait_for_slave_to_stop.inc +++ b/mysql-test/include/wait_for_slave_to_stop.inc @@ -28,7 +28,7 @@ while ($run) sleep 0.1; if (!$counter){ --echo "Failed while waiting for slave to stop" - SHOW SLAVE STATUS; + query_vertical SHOW SLAVE STATUS; exit; } dec $counter; diff --git a/mysql-test/t/rpl_row_until.test b/mysql-test/t/rpl_row_until.test index f1d21e65a4c..0552f9f7465 100644 --- a/mysql-test/t/rpl_row_until.test +++ b/mysql-test/t/rpl_row_until.test @@ -27,8 +27,7 @@ drop table t2; # try to replicate all queries until drop of t1 connection slave; start slave until master_log_file='master-bin.000001', master_log_pos=311; -sleep 2; -wait_for_slave_to_stop; +--source include/wait_for_slave_sql_to_stop.inc # here table should be still not deleted select * from t1; --replace_result $MASTER_MYPORT MASTER_MYPORT @@ -37,18 +36,16 @@ select * from t1; # this should fail right after start start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291; +--source include/wait_for_slave_sql_to_stop.inc # again this table should be still not deleted select * from t1; -sleep 2; -wait_for_slave_to_stop; --replace_result $MASTER_MYPORT MASTER_MYPORT --replace_column 1 # 9 # 11 # 23 # 33 # --query_vertical SHOW SLAVE STATUS; # try replicate all up to and not including the second insert to t2; start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728; -sleep 2; -wait_for_slave_to_stop; +--source include/wait_for_slave_sql_to_stop.inc select * from t2; --replace_result $MASTER_MYPORT MASTER_MYPORT --replace_column 1 # 9 # 11 # 23 # 33 # @@ -64,8 +61,7 @@ stop slave; # this should stop immediately as we are already there start slave until master_log_file='master-bin.000001', master_log_pos=740; -sleep 2; -wait_for_slave_to_stop; +--source include/wait_for_slave_sql_to_stop.inc # here the sql slave thread should be stopped --replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004 --replace_column 1 # 9 # 23 # 33 # diff --git a/mysql-test/t/rpl_stm_until.test b/mysql-test/t/rpl_stm_until.test index f42965c0eb0..5d6c97feb93 100644 --- a/mysql-test/t/rpl_stm_until.test +++ b/mysql-test/t/rpl_stm_until.test @@ -26,8 +26,7 @@ drop table t2; # try to replicate all queries until drop of t1 connection slave; start slave until master_log_file='master-bin.000001', master_log_pos=323; -sleep 2; -wait_for_slave_to_stop; +--source include/wait_for_slave_sql_to_stop.inc # here table should be still not deleted select * from t1; --replace_result $MASTER_MYPORT MASTER_MYPORT @@ -36,18 +35,16 @@ select * from t1; # this should fail right after start start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291; +--source include/wait_for_slave_sql_to_stop.inc # again this table should be still not deleted select * from t1; -sleep 2; -wait_for_slave_to_stop; --replace_result $MASTER_MYPORT MASTER_MYPORT --replace_column 1 # 9 # 11 # 23 # 33 # --query_vertical SHOW SLAVE STATUS # try replicate all up to and not including the second insert to t2; start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=746; -sleep 2; -wait_for_slave_to_stop; +--source include/wait_for_slave_sql_to_stop.inc select * from t2; --replace_result $MASTER_MYPORT MASTER_MYPORT --replace_column 1 # 9 # 11 # 23 # 33 # @@ -63,8 +60,7 @@ stop slave; # this should stop immediately as we are already there start slave until master_log_file='master-bin.000001', master_log_pos=776; -sleep 2; -wait_for_slave_to_stop; +--source include/wait_for_slave_sql_to_stop.inc # here the sql slave thread should be stopped --replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004 --replace_column 1 # 9 # 23 # 33 #