mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / mysql-test / include / wait_for_slave_io_error.inc
blobbd3468eebb63fef29f18c27b6d5e083a631751b3
1 # ==== Purpose ====
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.
8 # ==== Usage ====
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
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.)
26 #   $show_slave_io_error
27 #     If set, will print the error to the query log.
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
43 --let $include_filename= wait_for_slave_io_error.inc [errno=$slave_io_errno]
44 --source include/begin_include_file.inc
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;
54 let $_wfsie_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
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
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
71 if ($show_slave_io_error)
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
79 if (!$slave_io_error_is_nonfatal)
81   --let $slave_param= Slave_IO_State
82   --let $slave_param_value=
83   --source include/wait_for_slave_param.inc
85 --let $slave_io_error_is_nonfatal= 0
88 --let $include_filename= wait_for_slave_io_error.inc [errno=$slave_io_errno]
89 --source include/end_include_file.inc