1
0
mirror of https://github.com/MariaDB/server.git synced 2025-06-03 07:02:23 +03:00
mariadb/mysql-test/include/wait_for_slave_io_error.inc
cc05440836 Bug #49741 test files contain explicit references to bin/relay-log positions
Some of the test cases reference to binlog position and
these position numbers are written into result explicitly.
It is difficult to maintain if log event format changes. 

There are a couple of cases explicit position number appears, 
we handle them in different ways
A. 'CHANGE MASTER ...' with MASTER_LOG_POS or/and RELAY_LOG_POS options
   Use --replace_result to mask them.
B. 'SHOW BINLOG EVENT ...'
   Replaced by show_binlog_events.inc or wait_for_binlog_event.inc. 
   show_binlog_events.inc file's function is enhanced by given
   $binlog_file and $binlog_limit.
C. 'SHOW SLAVE STATUS', 'show_slave_status.inc' and 'show_slave_status2.inc'
   For the test cases just care a few items in the result of 'SHOW SLAVE STATUS',
   only the items related to each test case are showed.
   'show_slave_status.inc' is rebuild, only the given items in $status_items
   will be showed.
   'check_slave_is_running.inc' and 'check_slave_no_error.inc'
   and 'check_slave_param.inc' are auxiliary files helping
   to show running status and error information easily.
2010-05-24 21:54:08 +08:00

49 lines
1.5 KiB
PHP

# ==== Purpose ====
#
# Waits until the IO thread of the current connection has got an
# error, or until a timeout is reached. Also waits until the IO
# thread has completely stopped.
#
# ==== Usage ====
#
# source include/wait_for_slave_io_error.inc;
#
# Parameters:
#
# $slave_io_errno
# The expected IO error number. This is required.
# (After BUG#41956 has been fixed, this will be required to be a
# symbolic name instead of a number.)
#
# $show_slave_io_error
# If set, will print the error to the query log.
#
# $slave_timeout
# See wait_for_slave_param.inc for description.
#
# $master_connection
# See wait_for_slave_param.inc for description.
if (`SELECT '$slave_io_errno' = ''`) {
--die !!!ERROR IN TEST: you must set \$slave_io_errno before sourcing wait_for_slave_io_error.inc
}
let $slave_param= Slave_IO_Running;
let $slave_param_value= No;
let $slave_error_message= Failed while waiting for slave to stop the IO thread (expecting error in the IO thread);
source include/wait_for_slave_param.inc;
let $_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
if (`SELECT '$_error' != '$slave_io_errno'`) {
--echo **** Slave stopped with wrong error code: $_error (expected $slave_io_errno) ****
source include/show_rpl_debug_info.inc;
--echo **** Slave stopped with wrong error code: $_error (expected $slave_io_errno) ****
--die Slave stopped with wrong error code
}
if ($show_slave_io_error)
{
let $error= query_get_value("SHOW SLAVE STATUS", Last_IO_Error, 1);
echo Last_IO_Error = $error;
}