diff options
Diffstat (limited to 'mysql-test/include/wait_for_slave_to_stop.inc')
-rw-r--r-- | mysql-test/include/wait_for_slave_to_stop.inc | 59 |
1 files changed, 25 insertions, 34 deletions
diff --git a/mysql-test/include/wait_for_slave_to_stop.inc b/mysql-test/include/wait_for_slave_to_stop.inc index 5bd2d0338f8..56d0e7b0c91 100644 --- a/mysql-test/include/wait_for_slave_to_stop.inc +++ b/mysql-test/include/wait_for_slave_to_stop.inc @@ -1,39 +1,30 @@ -################################################### -#Author: Jeb -#Date: 2007-06-11 -#Purpose: To replace the mysqltest.c executable -# wait_for_slave_to_stop function and -# return this to the test language. -#Details: -# 1) Fill in and setup variables -# 2) loop through looking for both -# io and sql threads to stop -# 3) If loops too long die. -#################################################### -connection slave; -let $row_number= 1; -let $run= 1; -let $counter= 300; +# ==== Purpose ==== +# +# Waits until both the IO and SQL threads of the current connection +# have stopped, or until a timeout is reached. +# +# ==== Usage ==== +# +# source include/wait_for_slave_to_stop.inc; +# +# Parameters to this macro are $slave_timeout and +# $master_connection. See wait_for_slave_param.inc for +# descriptions. -while ($run) +# if server has not used CHANGE MASTER to initiate slave, SHOW SLAVE +# STATUS will return an empty set. +let $_slave_io_running= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1); +if (`SELECT '$_slave_io_running' != 'No such row'`) { - let $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number); - if (`SELECT '$io_result' = 'No'`){ + let $slave_error_message= Failed while waiting for slave to stop; - let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number); - if (`SELECT '$sql_result' = 'No'`){ - let $run= 0; - } - } - sleep 0.1; - if (!$counter){ - --echo "Failed while waiting for slave to stop" - --replace_result $MASTER_MYPORT MASTER_PORT - --replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # - query_vertical SHOW SLAVE STATUS; - exit; - } - dec $counter; -} + let $slave_param= Slave_IO_Running; + let $slave_param_value= No; + source include/wait_for_slave_param.inc; + let $slave_param= Slave_SQL_Running; + let $slave_param_value= No; + source include/wait_for_slave_param.inc; + let $slave_error_message= ; +} |