~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
# include/wait_slave_status.inc
2
#
3
# Created by Matthias Leich
4
#
5
# SUMMARY
6
#
7
#    Waits until slave has reached certain state or maximum time reached.
8
#
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.)
11
#
12
# USAGE
13
#
14
#    Set $result_pattern in test file and source this file:
15
#
16
#      let $result_pattern= <pattern used for LIKE on the result of
17
#                           SHOW STATUS SLAVE>
18
#      --include wait_slave_status.inc
19
#
20
# EXAMPLE
21
#
22
#    The script rpl_until.test:
23
#       ...
24
#       --replace_result $MASTER_MYPORT MASTER_MYPORT
25
#       --replace_column 1 # 9 # 23 # 33 #
26
#       --vertical_results show slave status;
27
#
28
#    outputs
29
#       show slave status;
30
#       Slave_IO_State  #
2465.1.4 by Brian Aker
Move from using 127.0.0.1, to localhost.
31
#       Master_Host     localhost
1 by brian
clean slate
32
#       Master_User     root
33
#       Master_Port     MASTER_MYPORT
34
#       Connect_Retry   1
35
#       Master_Log_File master-bin.000001
36
#       Read_Master_Log_Pos     776
37
#       Relay_Log_File  slave-relay-bin.000004
38
#       Relay_Log_Pos   #
39
#       Relay_Master_Log_File   master-bin.000001
40
#       Slave_IO_Running        Yes
41
#       Slave_SQL_Running       No
42
#       Replicate_Do_DB
43
#       Replicate_Ignore_DB
44
#       Replicate_Do_Table
45
#       Replicate_Ignore_Table
46
#       Replicate_Wild_Do_Table
47
#       Replicate_Wild_Ignore_Table
48
#       Last_Errno      0
49
#       Last_Error
50
#       Skip_Counter    0
51
#       Exec_Master_Log_Pos     319
52
#       Relay_Log_Space #
53
#       Until_Condition Master
54
#       Until_Log_File  master-bin.000001
55
#       Until_Log_Pos   319
56
#       Master_SSL_Allowed      No
57
#       Master_SSL_CA_File
58
#       Master_SSL_CA_Path
59
#       Master_SSL_Cert
60
#       Master_SSL_Cipher
61
#       Master_SSL_Key
62
#       Seconds_Behind_Master   #
63
#
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.
68
#
69
# The typical problem with rpl_until is that Slave_IO_Running is "No"
70
# instead of "Yes".
71
#
72
# The expected result follows the LIKE pattern:
73
#
2465.1.4 by Brian Aker
Move from using 127.0.0.1, to localhost.
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%';
1 by brian
clean slate
75
#
76
# The Slave_IO_Running value is the "Yes" just after the "master-bin.000001".
77
#
78
# How to get this pattern ?
79
#
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.
84
#
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 '%'.
88
#
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.
92
#
93
###############################################################################
94
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
97
# desired state.
98
--disable_query_log
99
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 "";
106
107
let $show_type= SLAVE STATUS;
108
let $show_pattern= $result_pattern;
109
--enable_query_log
110
111
--source include/wait_show_pattern.inc
112
113
if (!$success)
114
{
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
122
              |         too small.;
123
--source include/show_msg80.inc
124
--echo DEBUG INFO START (wait_slave_status.inc):
125
--echo $result_pattern
126
--vertical_results
127
show slave status;
128
--echo DEBUG INFO END
129
}