diff options
Diffstat (limited to 'mysql-test/include/wait_for_slave_sql_error.inc')
-rw-r--r-- | mysql-test/include/wait_for_slave_sql_error.inc | 68 |
1 files changed, 37 insertions, 31 deletions
diff --git a/mysql-test/include/wait_for_slave_sql_error.inc b/mysql-test/include/wait_for_slave_sql_error.inc index 6780edbe2f0..ad1d7a9e639 100644 --- a/mysql-test/include/wait_for_slave_sql_error.inc +++ b/mysql-test/include/wait_for_slave_sql_error.inc @@ -1,33 +1,39 @@ -################################################### -#Author: Sven -#Date: 2007-10-09 -#Purpose: Wait until the slave has an error in the -# sql thread, as indicated by -# "SHOW SLAVE STATUS", or at most 30 -# seconds. -#Details: -# 1) Fill in and setup variables -# 2) loop, looking for sql error on slave -# 3) If it loops too long, die. -#################################################### -connection slave; -let $row_number= 1; -let $run= 1; -let $counter= 300; +# ==== Purpose ==== +# +# Waits until the SQL thread of the current connection has got an +# error, or until a timeout is reached. Also waits until the SQL +# thread has completely stopped. +# +# ==== Usage ==== +# +# source include/wait_for_slave_sql_error.inc; +# +# Parameters: +# +# $slave_sql_errno +# The expected SQL error number. This is required. +# (After BUG#41956 has been fixed, this will be required to be a +# symbolic name instead of a number.) +# +# $slave_timeout +# See wait_for_slave_param.inc for description. +# +# $master_connection +# See wait_for_slave_param.inc for description. -while ($run) -{ - let $sql_result= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, $row_number); - let $run= `SELECT '$sql_result' = '0'`; - if ($run) { - real_sleep 0.1; - if (!$counter){ - --echo "Failed while waiting for slave to produce an error in its sql thread" - --replace_result $MASTER_MYPORT MASTER_PORT - --replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # - query_vertical SHOW SLAVE STATUS; - exit; - } - dec $counter; - } +if (`SELECT '$slave_sql_errno' = ''`) { + --echo !!!ERROR IN TEST: you must set \$slave_sql_errno before sourcing wait_fro_slave_sql_error.inc + exit; +} + +let $slave_param= Slave_SQL_Running; +let $slave_param_value= No; +let $slave_error_message= Failed while waiting for slave to stop the SQL thread (expecting error in the SQL thread); +source include/wait_for_slave_param.inc; + +let $_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1); +if (`SELECT '$_error' != '$slave_sql_errno'`) { + --echo Slave stopped with wrong error code: $_error (expected $slave_sql_errno) + source include/show_rpl_debug_info.inc; + exit; } |