Hi Sven!
See comments below.
Just my few cents,
Mats Kindahl
[snip]
> === modified file 'mysql-test/include/wait_for_slave_param.inc'
> --- a/mysql-test/include/wait_for_slave_param.inc 2007-06-15 11:09:28 +0000
> +++ b/mysql-test/include/wait_for_slave_param.inc 2008-07-10 13:10:36 +0000
> @@ -1,26 +1,86 @@
> -# include/wait_for_slave_param.inc
> +# ==== Purpose ====
> #
> -# SUMMARY
> +# Waits until SHOW SLAVE STATUS has returned a specified value, or
> +# until a timeout is reached.
> #
> -# Waits until SHOW SLAVE STATUS has returned a spicified value.
> +# ==== Usage ====
> #
> -# USAGE
> +# let $slave_param= Slave_SQL_Running;
> +# let $slave_param_value= No;
> +# --source include/slave_wait_param.inc
> #
> -# let $slave_param= Slave_SQL_Running;
> -# let $slave_param_value= No;
> -# --source include/slave_wait_param.inc
> +# Parameters:
> +#
> +# $slave_param, $slave_param_value
> +# This macro will wait until the column of the output of SHOW SLAVE
> +# STATUS named $slave_param gets the value $slave_param_value. See
> +# the example above.
> +#
> +# $slave_param_comparison
> +# By default, this file waits until $slave_param becomes equal to
> +# $slave_param_value. If you want to wait until $slave_param
> +# becomes *unequal* to $slave_param_value, set this parameter to the
> +# string '!=', like this:
> +# let $slave_param_comparison= !=;
> +#
> +# $timeout_counter
> +# The default timeout is 5 minutes. You can change the timeout by
> +# setting $timeout_counter. The unit is tenths of seconds.
> +#
> +# $keep_connection
> +# If the timeout is reached, debug info is given by calling SHOW
> +# SLAVE STATUS, SHOW PROCESSLIST, and SHOW BINLOG EVENTS. By
> +# default (assuming the current connection is slave), a 'connection
> +# master' is then issued, and the same information is printed again
> +# on the master host. You can turn off printing debug info on
> +# master by setting $keep_connection to 1.
... which is then guaranteed to not issue any "connection " directives.
This is the important usage of $keep_connection, not to suppress error
messages.
> +#
> +# $slave_error_message
> +# If set, this is printed when a timeout occurs. This is primarily
> +# intended to be used by other wait_for_slave_* macros, to indicate
> +# what the purpose of the wait was. (A very similar error message is
> +# given by default, but the wait_for_slave_* macros use this to give
> +# an error message identical to that in previous versions, so that
> +# errors are easier searchable in the pushbuild history.)
> +
> +let $_timeout_counter= $timeout_counter;
> +if (!$_timeout_counter)
> +{
> + let $_timeout_counter= 3000;
> +}
> +
> +let $_slave_param_comparison= $slave_param_comparison;
> +if (`SELECT '$_slave_param_comparison' = ''`)
> +{
> + let $_slave_param_comparison= =;
> +}
>
> -let $slave_wait_param_counter= 300;
> -let $slave_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1);
> -while (`select "$slave_value" != "$slave_param_value"`)
> +let $_show_slave_status_value= query_get_value("SHOW SLAVE STATUS", $slave_param,
> 1);
> +while (`SELECT NOT('$_show_slave_status_value' $_slave_param_comparison
> '$slave_param_value')`)
> {
> - dec $slave_wait_param_counter;
> - if (!$slave_wait_param_counter)
> + if (!$_timeout_counter)
> {
> - --echo ERROR: failed while waiting for slave parameter $slave_param:
> $slave_param_value
> - query_vertical show slave status;
> + --echo **** ERROR: failed while waiting for slave parameter $slave_param
> $_slave_param_comparison $slave_param_value ****
> + if (`SELECT '$slave_error_message' != ''`)
> + {
> + --echo Message: $slave_error_message
> + }
> + --echo Note: the following output may have changed since the failure was
> detected
> + --echo **** Showing SLAVE STATUS, PROCESSLIST, and BINLOG EVENTS on slave ****
> + query_vertical SHOW SLAVE STATUS;
> + SHOW PROCESSLIST;
> + SHOW BINLOG EVENTS;
This will just show binlog events for the *first* binlog file. I think a
better approach is to fetch the file and position on the "master" and
use that to print a part of the binary log that is useful. It is
possible to print the full binary log (in which case you don't need the
position).
> + if (!$keep_connection) {
> + echo --[on master]
> + --echo **** Showing MASTER STATUS, PROCESSLIST, and BINLOG EVENTS on master
> ****
> + connection master;
> + query_vertical SHOW MASTER STATUS;
> + SHOW PROCESSLIST;
> + SHOW BINLOG EVENTS;
See above.
[snippeti-snip]
> @@ -67,9 +66,7 @@ INSERT INTO t1 VALUES(6,'C',2);
> INSERT INTO t1(b,c) VALUES('B',2);
> # Wait while C will stop.
> --connection master_c
> ---let $slave_param= Slave_SQL_Running
> ---let $slave_param_value= No
> ---source include/wait_for_slave_param.inc
> +source include/wait_for_slave_sql_to_stop.inc;
It looked like the "connection master_c" was removed. I still think that
the "--" form should only be used for echo...
[snip]
> === modified file 'mysql-test/suite/rpl/t/rpl_packet.test'
> --- a/mysql-test/suite/rpl/t/rpl_packet.test 2008-04-30 02:56:44 +0000
> +++ b/mysql-test/suite/rpl/t/rpl_packet.test 2008-07-10 13:10:36 +0000
> @@ -18,10 +18,8 @@ SET @@global.net_buffer_length=1024;
>
> # Restart slave for setting to take effect
> connection slave;
> -STOP SLAVE;
> -source include/wait_for_slave_to_stop.inc;
> -START SLAVE;
> -source include/wait_for_slave_to_start.inc;
> +source include/stop_slave.inc;
> +source include/start_slave.inc;
Seems to be quite common to stop and start the slave, so why not a
"restart_slave" file?
--
Mats Kindahl
Lead Software Developer
Replication Team
MySQL AB, www.mysql.com