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
59 # $slave_field_result_replace
60 # If set, one or more regex patterns for replacing variable
61 # text in the error message. Syntax as --replace-regex
64 # If set, change the slave sql mode during this macro, reverting
65 # to the previous on exit. Default sql_mode is NO_BACKSLASH_ESCAPES
66 # to allow replace '\' by '/' making paths OS independent. Example:
68 # --let $slave_sql_mode= NO_BACKSLASH_ESCAPES
72 --let $_show_slave_status_items= $status_items
75 --die Bug in
test case: The mysqltest variable $status_items is not
set.
79 --let $_slave_sql_mode= NO_BACKSLASH_ESCAPES
82 --let $_slave_sql_mode= $slave_sql_mode
84 --let $_previous_slave_sql_mode = `SELECT @@sql_mode`
86 eval SET sql_mode=
'$_slave_sql_mode';
90 while ($_show_slave_status_items)
92 --let $_show_slave_status_name= `SELECT SUBSTRING_INDEX(
'$_show_slave_status_items',
',', 1)`
93 --let $_show_slave_status_items= `SELECT LTRIM(SUBSTRING(
'$_show_slave_status_items', LENGTH(
'$_show_slave_status_name') + 2))`
95 --let $_show_slave_status_value= query_get_value(SHOW SLAVE
STATUS, $_show_slave_status_name, 1)
96 --let $_slave_field_result_replace= /[\\]/\
97 --replace_regex $_slave_field_result_replace
98 --let $_show_slave_status_value= `SELECT
REPLACE(
"$_show_slave_status_value",
'$MYSQL_TEST_DIR',
'MYSQL_TEST_DIR')`
99 --echo $_show_slave_status_name =
'$_show_slave_status_value'
104 eval SET sql_mode=
'$_previous_slave_sql_mode';