1
# Include file to show the slave status, masking out some information
2
# that varies depending on where the test is executed.
4
--let $_items=$status_items
3
# Show selected columns of output from SHOW SLAVE STATUS.
5
# Note: test cases should never call SHOW SLAVE STATUS directly,
6
# because that outputs more information to the query log than what is
7
# needed for the property that is being tested. That would cause
8
# maintenance problems, because (1) it is hard for a human to
9
# understand what property is being tested; (2) the output of many of
10
# the fields is non-deterministic (e.g., Slave_IO_State) or changes
11
# frequently (e.g., binlog positions).
13
# Instead, what you want most of the time is to source one of the
16
# include/check_slave_no_error.inc
17
# Assert that Slave_SQL_Errno = Slave_IO_Errno = 0.
19
# include/check_slave_is_running.inc
20
# Assert that Slave_IO_Running = Slave_SQL_Running = 'Yes'.
22
# include/wait_for_slave_sql_error.inc
23
# Wait for the SQL thread to get a given error (and assert that
26
# include/wait_for_slave_io_error.inc
27
# Wait for the IO thread to get a given error (and assert that
30
# include/wait_for_slave_sql_to_stop.inc
31
# include/wait_for_slave_io_to_stop.inc
32
# include/wait_for_slave_to_stop.inc
33
# Wait for the SQL thread, the IO thread, or both to stop (and
36
# When none of the above applies, you may use this script instead.
37
# However, take care so that the test never contains explicit binlog
38
# coordinates. Usually you can read the binlog coordinates into a
39
# variable and compare it to some other coordinates.
44
# --let $status_items= Column_Name[, Column_Name[, ...]]
45
# --source include/show_slave_status.inc
49
# Set to the name of the column in the output of SHOW SLAVE STATUS
50
# that you want to display. Example:
52
# --let $status_items= Master_SSL_Allowed
54
# You can show multiple columns by setting $status_items to a
55
# comma-separated list. Example:
57
# --let $status_items= Master_Log_File, Relay_Master_Log_File
60
--let $_show_slave_status_items=$status_items
5
61
if (`SELECT "XX$status_items" = "XX"`)
7
--die 'Variable status_items is NULL'
63
--die Bug in test case: The mysqltest variable $status_items is not set.
13
while (`SELECT "XX$_items" <> "XX"`)
67
while (`SELECT "XX$_show_slave_status_items" <> "XX"`)
15
--let $_name= `SELECT SUBSTRING_INDEX('$_items', ',', 1)`
16
--let $_items= `SELECT LTRIM(SUBSTRING('$_items', LENGTH('$_name') + 2))`
18
--let $_value= query_get_value(SHOW SLAVE STATUS, $_name, 1)
20
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
21
--eval SELECT "$_value" AS $_name
69
--let $_show_slave_status_name= `SELECT SUBSTRING_INDEX('$_show_slave_status_items', ',', 1)`
70
--let $_show_slave_status_items= `SELECT LTRIM(SUBSTRING('$_show_slave_status_items', LENGTH('$_show_slave_status_name') + 2))`
72
--let $_show_slave_status_value= query_get_value(SHOW SLAVE STATUS, $_show_slave_status_name, 1)
73
--let $_show_slave_status_value= `SELECT REPLACE("$_show_slave_status_value", '$MYSQL_TEST_DIR', 'MYSQL_TEST_DIR')`
74
--echo $_show_slave_status_name = '$_show_slave_status_value'