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 0111edaff58..16a03d94511 100644 --- a/mysql-test/include/wait_for_slave_io_to_stop.inc +++ b/mysql-test/include/wait_for_slave_io_to_stop.inc @@ -11,8 +11,14 @@ # $slave_keep_connection. See wait_for_slave_param.inc for # descriptions. -let $slave_param= Slave_IO_Running; -let $slave_param_value= No; -let $slave_error_message= Failed while waiting for slave IO thread to stop; -source include/wait_for_slave_param.inc; -let $slave_error_message= ; +# 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 $slave_param= Slave_IO_Running; + let $slave_param_value= No; + let $slave_error_message= Failed while waiting for slave IO thread to stop; + source include/wait_for_slave_param.inc; + let $slave_error_message= ; +} 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 477dfecbb30..565203a9f59 100644 --- a/mysql-test/include/wait_for_slave_sql_to_stop.inc +++ b/mysql-test/include/wait_for_slave_sql_to_stop.inc @@ -11,8 +11,14 @@ # $slave_keep_connection. See wait_for_slave_param.inc for # descriptions. -let $slave_param= Slave_SQL_Running; -let $slave_param_value= No; -let $slave_error_message= Failed while waiting for slave SQL thread to stop; -source include/wait_for_slave_param.inc; -let $slave_error_message= ; +# 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 $slave_param= Slave_SQL_Running; + let $slave_param_value= No; + let $slave_error_message= Failed while waiting for slave SQL thread to stop; + source include/wait_for_slave_param.inc; + let $slave_error_message= ; +} diff --git a/mysql-test/include/wait_for_slave_to_stop.inc b/mysql-test/include/wait_for_slave_to_stop.inc index 4973a27dc53..86604a15b95 100644 --- a/mysql-test/include/wait_for_slave_to_stop.inc +++ b/mysql-test/include/wait_for_slave_to_stop.inc @@ -11,14 +11,20 @@ # $slave_keep_connection. See wait_for_slave_param.inc for # descriptions. -let $slave_error_message= Failed while waiting for slave to stop; +# 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 $slave_error_message= Failed while waiting for slave to stop; -let $slave_param= Slave_IO_Running; -let $slave_param_value= No; -source include/wait_for_slave_param.inc; + 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_param= Slave_SQL_Running; + let $slave_param_value= No; + source include/wait_for_slave_param.inc; -let $slave_error_message= ; + let $slave_error_message= ; +}