summaryrefslogtreecommitdiff
path: root/mysql-test/include/wait_for_slave_io_error.inc
blob: 34cbf20a73b47cb9cefaa73d330ed014efdce2c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# ==== 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 ====
#
# # Wait several errors.  
# let $slave_io_errno= 1, 2, 3; 
# source include/wait_for_slave_io_error.inc;
#
# # Print error message 
# let $slave_io_errno= 1; 
# let $show_slave_io_error= 1; 
# source include/wait_for_slave_io_error.inc;
#
# Parameters:
#
# $slave_io_errno
#   The expected IO error numbers.  This is required.
#   (After BUG#41956 has been fixed, this will be required to be a
#   symbolic name instead of a numbers.)
#
# $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 $old_slave_param_comparison= $slave_param_comparison;
let $slave_param= Last_IO_Errno;
let $slave_param_comparison= !=;
let $slave_param_value= 0;
let $slave_error_message= Failed while waiting for slave to produce an error in its sql thread;
source include/wait_for_slave_param.inc;
let $slave_error_message= ;
let $slave_param_comparison= $old_slave_param_comparison;

let $_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
if (`SELECT $_error NOT IN ($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;
}