1
# include/wait_slave_status.inc
3
# Created by Matthias Leich
7
# Waits until slave has reached certain state or maximum time reached.
9
# (This script will not work, when the SHOW command delivers more than one
10
# result record, because only the first record will be caught.)
14
# Set $result_pattern in test file and source this file:
16
# let $result_pattern= <pattern used for LIKE on the result of
18
# --include wait_slave_status.inc
22
# The script rpl_until.test:
24
# --replace_result $MASTER_MYPORT MASTER_MYPORT
25
# --replace_column 1 # 9 # 23 # 33 #
26
# --vertical_results show slave status;
31
# Master_Host localhost
33
# Master_Port MASTER_MYPORT
35
# Master_Log_File master-bin.000001
36
# Read_Master_Log_Pos 776
37
# Relay_Log_File slave-relay-bin.000004
39
# Relay_Master_Log_File master-bin.000001
40
# Slave_IO_Running Yes
41
# Slave_SQL_Running No
45
# Replicate_Ignore_Table
46
# Replicate_Wild_Do_Table
47
# Replicate_Wild_Ignore_Table
51
# Exec_Master_Log_Pos 319
53
# Until_Condition Master
54
# Until_Log_File master-bin.000001
56
# Master_SSL_Allowed No
62
# Seconds_Behind_Master #
64
# The main problem with the "show slave status;" in rpl_until is, that
65
# depending on the total test engine power and the current load caused by
66
# other processes, the expected slave status might be not reached though
67
# it will happen in maybe some seconds.
69
# The typical problem with rpl_until is that Slave_IO_Running is "No"
72
# The expected result follows the LIKE pattern:
74
# let $result_pattern= '%localhost%root%1%master-bin.000001%776%slave-relay-bin.000004%master-bin.000001%Yes%No%0%0%319%Master%master-bin.000001%319%No%';
76
# The Slave_IO_Running value is the "Yes" just after the "master-bin.000001".
78
# How to get this pattern ?
80
# Any lines "--replace_result ..." and "--replace_colum ..." just before
81
# the SHOW TABLE STATUS and of course the expected result itself
82
# show us columns where the content must be unified, because it is non
83
# deterministic or it depends on the current test environment.
85
# Unfortunately "--replace_result ..." and "--replace_colum ..." do not
86
# affect the result of our assignment let $my_val= `SHOW SLAVE STATUS`;
87
# Therefore such content must be covered by '%'.
89
# Please be careful. A more simple pattern might be dangerous, because we
90
# might get "wrong" matches. Example: There might be several "Yes" and "No"
91
# within one result row.
93
###############################################################################
95
# We do not want to print the auxiliary commands, because they are not of
96
# interest and their amount will vary depending how fast we get the
100
# The protocol should show
101
# - the setting of $result_pattern and
102
# - that this file is sourced ,
103
# because this increases the chance to use the protocol as replay script.
104
eval SELECT "let \$result_pattern= $result_pattern ;" AS "";
105
SELECT '--source include/wait_slave_status.inc' AS "";
107
let $show_type= SLAVE STATUS;
108
let $show_pattern= $result_pattern;
111
--source include/wait_show_pattern.inc
115
let $message= ! Attention: Timeout in wait_slave_status.inc.
116
| Possible reasons with decreasing probability:
117
| - The LIKE pattern is wrong, because the
118
| testcase was altered or the layout of the
119
| SHOW SLAVE STATUS result set changed.
120
| - There is a new bug within the replication.
121
| - We met an extreme testing environment and timeout is
123
--source include/show_msg80.inc
124
--echo DEBUG INFO START (wait_slave_status.inc):
125
--echo $result_pattern
128
--echo DEBUG INFO END