3
# Waits until SHOW SLAVE STATUS has returned a specified value, or
4
# until a timeout is reached.
8
# let $slave_param= Slave_SQL_Running;
9
# let $slave_param_value= No;
10
# source include/slave_wait_param.inc;
14
# $slave_param, $slave_param_value
15
# This macro will wait until the column of the output of SHOW SLAVE
16
# STATUS named $slave_param gets the value $slave_param_value. See
19
# $slave_param_comparison
20
# By default, this file waits until $slave_param becomes equal to
21
# $slave_param_value. If you want to wait until $slave_param
22
# becomes *unequal* to $slave_param_value, set this parameter to the
23
# string '!=', like this:
24
# let $slave_param_comparison= !=;
27
# The default timeout is 5 minutes. You can change the timeout by
28
# setting $slave_timeout. The unit is tenths of seconds.
31
# If the timeout is reached, debug info is given by calling SHOW
32
# SLAVE STATUS, SHOW PROCESSLIST, and SHOW BINLOG EVENTS. Then, a
33
# 'connection master' is then issued, and more debug info is given
34
# by calling SHOW MASTER STATUS, SHOW PROCESSLIST, and SHOW BINLOG
35
# EVENTS. If $master_connection is set, the latter three commands
36
# will be issued on $master_connection instead of on the host named
37
# 'master'. See also show_rpl_debug_info.inc
39
# $slave_error_message
40
# If set, this is printed when a timeout occurs. This is primarily
41
# intended to be used by other wait_for_slave_* macros, to indicate
42
# what the purpose of the wait was. (A very similar error message is
43
# given by default, but the wait_for_slave_* macros use this to give
44
# an error message identical to that in previous versions, so that
45
# errors are easier searchable in the pushbuild history.)
47
let $_slave_timeout_counter= $slave_timeout;
48
if (!$_slave_timeout_counter)
50
let $_slave_timeout_counter= 3000;
53
let $_slave_param_comparison= $slave_param_comparison;
54
if (`SELECT '$_slave_param_comparison' = ''`)
56
let $_slave_param_comparison= =;
59
let $_show_slave_status_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1);
60
while (`SELECT NOT('$_show_slave_status_value' $_slave_param_comparison '$slave_param_value') AND $_slave_timeout_counter > 0`)
62
dec $_slave_timeout_counter;
63
if ($_slave_timeout_counter)
66
let $_show_slave_status_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1);
70
# This has to be outside the loop until BUG#41913 has been fixed
71
if (!$_slave_timeout_counter)
73
--echo **** ERROR: timeout after $slave_timeout seconds while waiting for slave parameter $slave_param $_slave_param_comparison $slave_param_value ****
74
if (`SELECT '$slave_error_message' != ''`)
76
--echo Message: $slave_error_message
78
--echo Current connection is '$CURRENT_CONNECTION'
79
echo Note: the following output may have changed since the failure was detected;
80
source include/show_rpl_debug_info.inc;