~ubuntu-branches/ubuntu/precise/mysql-5.5/precise-201203300109

« back to all changes in this revision

Viewing changes to mysql-test/include/wait_for_slave_io_error.inc

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2011-11-08 11:31:13 UTC
  • Revision ID: package-import@ubuntu.com-20111108113113-3ulw01fvi4vn8m25
Tags: upstream-5.5.17
ImportĀ upstreamĀ versionĀ 5.5.17

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# ==== Purpose ====
 
2
#
 
3
# Waits until the IO thread of the current connection has got an
 
4
# error, or until a timeout is reached. Also waits until the IO
 
5
# thread has completely stopped.
 
6
#
 
7
#
 
8
# ==== Usage ====
 
9
#
 
10
# --let $slave_io_errno= NUMBER [, NUMBER ...]
 
11
# [--let $show_slave_io_error= 1]
 
12
# [--let $slave_io_error_is_nonfatal= 1]
 
13
# [--let $rpl_debug= 1]
 
14
# [--let $slave_timeout= NUMBER]
 
15
# --source include/wait_for_slave_io_error.inc
 
16
#
 
17
# Parameters:
 
18
#   $slave_io_errno
 
19
#     The expected IO error numbers. This can be either a single
 
20
#     number, or a comma-separated list of numbers. Examples:
 
21
#       --let $slave_io_errno= 1040, 1053, 2002, 2003, 2006, 2013
 
22
#       --let $slave_io_errno= 1045
 
23
#     (After BUG#41956 has been fixed, this will be required to be
 
24
#     symbolic names instead of numbers.)
 
25
#
 
26
#   $show_slave_io_error
 
27
#     If set, will print the error to the query log.
 
28
#
 
29
#   $slave_io_error_is_nonfatal
 
30
#     By default, we wait for the slave IO thread to stop completely
 
31
#     (i.e., until Slave_IO_State is empty).  If this variable is set,
 
32
#     then we don't wait. This is useful if the error is non-fatal
 
33
#     (e.g., temporary connection error) and does not cause the slave
 
34
#     IO thread to stop.
 
35
 
36
#   $slave_timeout
 
37
#     See include/wait_for_slave_param.inc
 
38
 
39
#   $rpl_debug
 
40
#     See include/rpl_init.inc
 
41
 
 
42
 
 
43
--let $include_filename= wait_for_slave_io_error.inc [errno=$slave_io_errno]
 
44
--source include/begin_include_file.inc
 
45
 
 
46
 
 
47
let $old_slave_param_comparison= $slave_param_comparison;
 
48
let $slave_param= Last_IO_Errno;
 
49
let $slave_param_comparison= !=;
 
50
let $slave_param_value= 0;
 
51
source include/wait_for_slave_param.inc;
 
52
let $slave_param_comparison= $old_slave_param_comparison;
 
53
 
 
54
let $_wfsie_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
 
55
 
 
56
if ($slave_io_errno == '') {
 
57
  --echo !!!ERROR IN TEST: you must set \$slave_io_errno before you source
 
58
  --echo !!!wait_for_slave_sql_error.inc. The error we got this time was '$_wfsie_errno',
 
59
  --echo !!!so you probably want to add the following line to your test case:
 
60
  --echo !!!  --let \$slave_io_errno= $_wfsie_errno
 
61
  --die !!!ERROR IN TEST: you must set \$slave_io_errno before sourcing wait_for_slave_io_error.inc
 
62
}
 
63
 
 
64
if (`SELECT $_wfsie_errno NOT IN ($slave_io_errno)`) {
 
65
  --echo **** Slave stopped with wrong error code: $_wfsie_errno (expected $slave_io_errno) ****
 
66
  source include/show_rpl_debug_info.inc;
 
67
  --echo **** Slave stopped with wrong error code: $_wfsie_errno (expected $slave_io_errno) ****
 
68
  --die Slave stopped with wrong error code
 
69
}
 
70
 
 
71
if ($show_slave_io_error)
 
72
{
 
73
  --let $_wait_for_slave_io_error_old_status_items= $status_items
 
74
  --let $status_items= Last_IO_Error
 
75
  --source include/show_slave_status.inc
 
76
  --let $status_items= $_wait_for_slave_io_error_old_status_items
 
77
}
 
78
 
 
79
if (!$slave_io_error_is_nonfatal)
 
80
{
 
81
  --let $slave_param= Slave_IO_State
 
82
  --let $slave_param_value=
 
83
  --source include/wait_for_slave_param.inc
 
84
}
 
85
--let $slave_io_error_is_nonfatal= 0
 
86
 
 
87
 
 
88
--let $include_filename= wait_for_slave_io_error.inc [errno=$slave_io_errno]
 
89
--source include/end_include_file.inc