diff options
author | Alexander Nozdrin <alik@sun.com> | 2010-06-17 10:13:11 +0400 |
---|---|---|
committer | Alexander Nozdrin <alik@sun.com> | 2010-06-17 10:13:11 +0400 |
commit | 1337df3b799c7cf643f3049c46e3b18ae4847d18 (patch) | |
tree | a88dcd4a0a44ef887cb73e2064196e123ac50215 /mysql-test/include | |
parent | 72584c312d00048af4385dfa7b4cb4a69a8721bf (diff) | |
parent | 48c07a39c48f685e9442ae8f73a6312ae7481f8f (diff) | |
download | mariadb-git-1337df3b799c7cf643f3049c46e3b18ae4847d18.tar.gz |
Auto-merge from mysql-trunk.
Diffstat (limited to 'mysql-test/include')
19 files changed, 316 insertions, 122 deletions
diff --git a/mysql-test/include/check_slave_is_running.inc b/mysql-test/include/check_slave_is_running.inc new file mode 100644 index 00000000000..5fbbe0d684c --- /dev/null +++ b/mysql-test/include/check_slave_is_running.inc @@ -0,0 +1,18 @@ +# ==== Purpose ==== +# +# Assert that the slave threads are running and don't have any errors. +# +# ==== Usage ==== +# +# --source include/check_slave_running.inc + +--echo Checking that both slave threads are running. + +--let $slave_sql_running = query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1) +--let $slave_io_running = query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1) + +if (`SELECT '$slave_sql_running' != 'Yes' OR '$slave_io_running' != 'Yes'`) { + --echo Slave not running: Slave_SQL_Running = $slave_sql_running Slave_IO_Running = $slave_io_running + --source include/show_rpl_debug_info.inc + --die Expected slave to be running, but it was not running. +} diff --git a/mysql-test/include/check_slave_no_error.inc b/mysql-test/include/check_slave_no_error.inc new file mode 100644 index 00000000000..371db5ed6a0 --- /dev/null +++ b/mysql-test/include/check_slave_no_error.inc @@ -0,0 +1,17 @@ +# ==== Purpose ==== +# +# Assert that Slave_SQL_Error and Slave_IO_Error are empty. +# +# ==== Usage ==== +# +# --let $slave_param= Exec_Master_Log_Pos +# --let $slave_param_value= 4711 +# --source include/check_slave_running.inc + +--let $slave_param= Last_SQL_Errno +--let $slave_param_value= 0 +--source include/check_slave_param.inc + +--let $slave_param= Last_IO_Errno +--let $slave_param_value= 0 +--source include/check_slave_param.inc diff --git a/mysql-test/include/check_slave_param.inc b/mysql-test/include/check_slave_param.inc new file mode 100644 index 00000000000..d82c26851ea --- /dev/null +++ b/mysql-test/include/check_slave_param.inc @@ -0,0 +1,16 @@ +# ==== Purpose ==== +# +# Assert that a given column in SHOW SLAVE STATUS has a given value. +# +# ==== Usage ==== +# +# --let $slave_param= Exec_Master_Log_Pos +# --let $slave_param_value= 4711 +# --source include/check_slave_param.inc + +--let $_param_value= query_get_value(SHOW SLAVE STATUS, $slave_param, 1) +if (`SELECT '$_param_value' != '$slave_param_value'`) { + --echo Wrong value for $slave_param. Expected '$slave_param_value', got '$_param_value' + --source include/show_rpl_debug_info.inc + --die Wrong value for slave parameter +} diff --git a/mysql-test/include/get_relay_log_pos.inc b/mysql-test/include/get_relay_log_pos.inc new file mode 100644 index 00000000000..7ce36fd3c50 --- /dev/null +++ b/mysql-test/include/get_relay_log_pos.inc @@ -0,0 +1,70 @@ +# For a given event which is at position $master_log_pos in the the master's +# binary log, returns its position in the slave's relay log file +# $relay_log_file. +# The position is stored in the variable $relay_log_pos. + +# Usage: +# let $relay_log_file= 'relay-log-bin.000001'; +# let $master_log_pos= 106; +# source include/get_relay_log_pos.inc; +# # at this point, get_relay_log_pos.inc sets $relay_log_pos. echo position +# # in $relay_log_file: $relay_log_pos. + +if (`SELECT '$relay_log_file' = ''`) +{ + --die 'variable $relay_log_file is null' +} + +if (`SELECT '$master_log_pos' = ''`) +{ + --die 'variable $master_log_pos is null' +} + +let $MYSQLD_DATADIR= `select @@datadir`; +let $_suffix= `SELECT UUID()`; +let $_tmp_file= $MYSQLTEST_VARDIR/tmp/mysqlbinlog.$_suffix; +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/$relay_log_file > $_tmp_file + +# All queries in this file should not be logged. +--disable_query_log + +--disable_warnings +DROP TEMPORARY TABLE IF EXISTS mysqlbinlog_events; +DROP TEMPORARY TABLE IF EXISTS events_at; +DROP TEMPORARY TABLE IF EXISTS events_pos; +CREATE TEMPORARY TABLE mysqlbinlog_events(c1 INT AUTO_INCREMENT KEY, c2 varchar(256)); + +# Event position is in the comments output by mysqlbinlog, we load this +# comments into the table +# '# at 106' +# '# .... end_log_pos 46' +eval LOAD DATA LOCAL INFILE '$_tmp_file' INTO TABLE mysqlbinlog_events + LINES STARTING BY '#' (c2) SET c1 = NULL; +--enable_warnings + +# Event pos in relay log file is inserted into table events_at +CREATE TEMPORARY TABLE events_at(c1 INT AUTO_INCREMENT KEY, c2 varchar(256)) + SELECT c2 FROM mysqlbinlog_events WHERE c2 LIKE ' at%' ORDER BY c1; + +# Event pos in master log file is inserted into table events_pos +CREATE TEMPORARY TABLE events_pos(c1 INT AUTO_INCREMENT KEY, c2 varchar(256)) + SELECT c2 FROM mysqlbinlog_events WHERE c2 LIKE '% end_log_pos %' ORDER BY c1; + +# events_at events_pos +# c1------c2-------------------------- c1------c2------------------------ +# 1 ev1's begin pos in relay log 1 ev1's end pos in master log +# 2 ev2's begin pos in relay log 2 ev2's end pos in master log +# 3 ev3's begin pos in relay log 3 ev3's end pos in master log +# events always keep the same sequence. +# Because event[N]'s end pos is equal to event[N+1]'s begin pos we want to +# find event's end pos in relay log, we can find the right relay_log_pos +# using the relationship that 'events_pos.c1 = events_at.c1 + 1' +# +# There is a fault that we can't get the relay log position of the last event, +# as it is not output by mysqlbinlog +let $relay_log_pos= `SELECT SUBSTRING(a.c2, 5) + FROM events_at a, events_pos b + WHERE a.c1=b.c1+1 and b.c2 LIKE '% $master_log_pos%'`; +DROP TEMPORARY TABLE mysqlbinlog_events, events_at, events_pos; +--remove_file $_tmp_file +--enable_query_log diff --git a/mysql-test/include/rpl_stmt_seq.inc b/mysql-test/include/rpl_stmt_seq.inc index 6c944dc4729..08f6e44aba0 100644 --- a/mysql-test/include/rpl_stmt_seq.inc +++ b/mysql-test/include/rpl_stmt_seq.inc @@ -80,9 +80,8 @@ eval INSERT INTO t1 SET f1= $MAX + 1; SELECT MAX(f1) FROM t1; if ($show_binlog) { ---replace_result $VERSION VERSION ---replace_column 2 # 5 # -eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s'; + --let $binlog_file= master-bin.$_log_num_s + --source include/show_binlog_events.inc } sync_slave_with_master; @@ -93,9 +92,8 @@ connection slave; SELECT MAX(f1) FROM t1; if ($show_binlog) { ---replace_result $VERSION VERSION ---replace_column 2 # 5 # -eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s'; + --let $binlog_file= slave-bin.$_log_num_s + --source include/show_binlog_events.inc } ############################################################### @@ -111,9 +109,8 @@ let $my_stmt= ERROR: YOU FORGOT TO FILL IN THE STATEMENT; SELECT MAX(f1) FROM t1; if ($show_binlog) { ---replace_result $VERSION VERSION ---replace_column 2 # 5 # -eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s'; + --let $binlog_file= master-bin.$_log_num_s + --source include/show_binlog_events.inc } sync_slave_with_master; @@ -124,9 +121,8 @@ connection slave; SELECT MAX(f1) FROM t1; if ($show_binlog) { ---replace_result $VERSION VERSION ---replace_column 2 # 5 # -eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s'; + --let $binlog_file= slave-bin.$_log_num_s + --source include/show_binlog_events.inc } ############################################################### @@ -150,9 +146,8 @@ eval SELECT CONCAT(CONCAT('TEST-INFO: MASTER: The INSERT is ', --enable_query_log if ($show_binlog) { ---replace_result $VERSION VERSION ---replace_column 2 # 5 # -eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s'; + --let $binlog_file= master-bin.$_log_num_s + --source include/show_binlog_events.inc } sync_slave_with_master; @@ -171,9 +166,8 @@ eval SELECT CONCAT(CONCAT('TEST-INFO: SLAVE: The INSERT is ', --enable_query_log if ($show_binlog) { ---replace_result $VERSION VERSION ---replace_column 2 # 5 # -eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s'; + --let $binlog_file= slave-bin.$_log_num_s + --source include/show_binlog_events.inc } ############################################################### diff --git a/mysql-test/include/show_binlog_events.inc b/mysql-test/include/show_binlog_events.inc index fcdc52eaf14..05f99f4a64d 100644 --- a/mysql-test/include/show_binlog_events.inc +++ b/mysql-test/include/show_binlog_events.inc @@ -1,35 +1,21 @@ -# $binlog_start can be set by caller or take a default value -# $binary_log_file the name of the log file show -# $binary_log_limit_row - sets the number of binlog rows to be returned -# $binary_log_limit_offset - sets the offset where to start returning events +############################################################################## +# Show binary log events +# +# Useage: +# let $binlog_file= master-bin.000002; +# let $binlog_start= 106; +# let $binlog_limit= 1, 3; +# source include/show_binlog_events.inc; +# +# It shows the first binary log file if $binlog_file is not given. +# +# It shows events from the end position of the description event if +# $binlog_start is not given. +# +# It shows all of the events if $binlog_limit is not given. +# $binlog_format has the same semantic with 'LIMIT' option. +# +############################################################################## -let $show_binlog_events= show binlog events; - -if (!$binlog_start) -{ - # defaults to chop the first event in the binary log - let $binlog_start=107; -} - -if (!`SELECT '$binary_log_file' = ''`) -{ - let $show_binlog_events= $show_binlog_events in '$binary_log_file'; -} -let $show_binlog_events= $show_binlog_events from $binlog_start; - -if ($binary_log_limit_row) -{ - let $limit= limit; - if ($binary_log_limit_offset) - { - let $limit= $limit $binary_log_limit_offset, ; - } - - let $limit= $limit $binary_log_limit_row; - let $show_binlog_events= $show_binlog_events $limit; -} - ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start <binlog_start> ---replace_column 2 # 4 # 5 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ ---eval $show_binlog_events +--let $is_relay_log= 0 +--source include/show_events.inc diff --git a/mysql-test/include/show_events.inc b/mysql-test/include/show_events.inc new file mode 100644 index 00000000000..2fd0bc6dbd8 --- /dev/null +++ b/mysql-test/include/show_events.inc @@ -0,0 +1,36 @@ +############################################################################## +# It's an auxiliary file used to show binary log events or relay log events. +# It is only called by show_binlog_events.inc and show_relaylog_events.inc. +############################################################################## + +if (!$binlog_start) +{ + # If $binlog_start is not set, we will set it as the second event's + # position. The first event(Description Event) is always ignored. For + # description event's length might be changed because of adding new events, + # 'SHOW BINLOG EVENTS LIMIT 1' is used to get the right value. + --let $binlog_start= query_get_value(SHOW BINLOG EVENTS LIMIT 1, End_log_pos, 1) +} + +--let $_statement=show binlog events +if ($is_relay_log) +{ + --let $_statement=show relaylog events +} + +if (`SELECT '$binlog_file' <> ''`) +{ + --let $_statement= $_statement in '$binlog_file' +} + +--let $_statement= $_statement from $binlog_start + +if (`SELECT '$binlog_limit' <> ''`) +{ + --let $_statement= $_statement limit $binlog_limit +} + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start <binlog_start> +--replace_column 2 # 4 # 5 # +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ /Server ver:.*$/SERVER_VERSION, BINLOG_VERSION/ +--eval $_statement diff --git a/mysql-test/include/show_relaylog_events.inc b/mysql-test/include/show_relaylog_events.inc index 6f63b055d58..d1bd11f1642 100644 --- a/mysql-test/include/show_relaylog_events.inc +++ b/mysql-test/include/show_relaylog_events.inc @@ -1,35 +1,21 @@ -# $binlog_start can be set by caller or take a default value -# $binary_log_file the name of the log file show -# $binary_log_limit_row - sets the number of binlog rows to be returned -# $binary_log_limit_offset - sets the offset where to start returning events +############################################################################## +# Show relay log events +# +# Useage: +# let $binlog_file= slave-relay-bin.000002; +# let $binlog_start= 106; +# let $binlog_limit= 1, 3; +# source include/show_relaylog_events.inc; +# +# It shows the first relay log file if $binlog_file is not given. +# +# It shows events from the end position of the description event if +# $binlog_start is not given. +# +# It shows all of the events if $binlog_limit is not given. +# $binlog_format has the same semantic with 'LIMIT' option. +# +############################################################################## -let $show_binlog_events= show relaylog events; - -if (!$binlog_start) -{ - # defaults to chop the first event in the binary log - let $binlog_start=106; -} - -if (!`SELECT '$binary_log_file' = ''`) -{ - let $show_binlog_events= $show_binlog_events in '$binary_log_file'; -} -let $show_binlog_events= $show_binlog_events from $binlog_start; - -if ($binary_log_limit_row) -{ - let $limit= limit; - if ($binary_log_limit_offset) - { - let $limit= $limit $binary_log_limit_offset, ; - } - - let $limit= $limit $binary_log_limit_row; - let $show_binlog_events= $show_binlog_events $limit; -} - ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start <binlog_start> ---replace_column 2 # 4 # 5 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ /Server ver:.*$/SERVER_VERSION, BINLOG_VERSION/ ---eval $show_binlog_events +--let $is_relay_log= 1 +--source include/show_events.inc diff --git a/mysql-test/include/show_rpl_debug_info.inc b/mysql-test/include/show_rpl_debug_info.inc index 252d63f1bf4..148d11f3b02 100644 --- a/mysql-test/include/show_rpl_debug_info.inc +++ b/mysql-test/include/show_rpl_debug_info.inc @@ -36,6 +36,7 @@ let $_con= $CURRENT_CONNECTION; --echo --echo [on $_con] --echo +SELECT NOW(); --echo **** SHOW SLAVE STATUS on $_con **** query_vertical SHOW SLAVE STATUS; --echo @@ -70,6 +71,7 @@ if (`SELECT '$_master_con' != ''`) --echo [on $_master_con] connection $_master_con; --echo + SELECT NOW(); --echo **** SHOW MASTER STATUS on $_master_con **** query_vertical SHOW MASTER STATUS; --echo diff --git a/mysql-test/include/show_slave_status.inc b/mysql-test/include/show_slave_status.inc index b315b9e45ca..d66c068e19b 100644 --- a/mysql-test/include/show_slave_status.inc +++ b/mysql-test/include/show_slave_status.inc @@ -1,6 +1,25 @@ # Include file to show the slave status, masking out some information # that varies depending on where the test is executed. ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 8 # 9 # 16 # 23 # 33 # 35 # 36 # -query_vertical SHOW SLAVE STATUS; +--let $_items=$status_items +if (`SELECT "XX$status_items" = "XX"`) +{ + --die 'Variable status_items is NULL' +} + +--disable_query_log +--vertical_results + +while (`SELECT "XX$_items" <> "XX"`) +{ + --let $_name= `SELECT SUBSTRING_INDEX('$_items', ',', 1)` + --let $_items= `SELECT LTRIM(SUBSTRING('$_items', LENGTH('$_name') + 2))` + + --let $_value= query_get_value(SHOW SLAVE STATUS, $_name, 1) + + --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR + --eval SELECT "$_value" AS $_name +} + +--horizontal_results +--enable_query_log diff --git a/mysql-test/include/show_slave_status2.inc b/mysql-test/include/show_slave_status2.inc deleted file mode 100644 index 7e970b31d8e..00000000000 --- a/mysql-test/include/show_slave_status2.inc +++ /dev/null @@ -1,8 +0,0 @@ -# Include file to show the slave status, masking out some information -# that varies depending on where the test is executed. - -# masked out log positions - ---replace_result $MASTER_MYPORT MASTER_PORT $DEFAULT_MASTER_PORT 3306 ---replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # -query_vertical SHOW SLAVE STATUS; diff --git a/mysql-test/include/test_fieldsize.inc b/mysql-test/include/test_fieldsize.inc index 606bc63779d..105574b15b9 100644 --- a/mysql-test/include/test_fieldsize.inc +++ b/mysql-test/include/test_fieldsize.inc @@ -22,10 +22,9 @@ eval $test_insert; connection slave; START SLAVE; ---source include/wait_for_slave_sql_to_stop.inc ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # ---query_vertical SHOW SLAVE STATUS +--let $slave_sql_errno= 1677 +--let $show_slave_sql_error= 1 +--source include/wait_for_slave_sql_error.inc # The following should be 0 SELECT COUNT(*) FROM t1; diff --git a/mysql-test/include/wait_for_binlog_event.inc b/mysql-test/include/wait_for_binlog_event.inc index 2a57c191413..7a55c8c2182 100644 --- a/mysql-test/include/wait_for_binlog_event.inc +++ b/mysql-test/include/wait_for_binlog_event.inc @@ -18,7 +18,7 @@ while (`SELECT INSTR("$_last_event","$wait_binlog_event") = 0`) dec $_loop_count; if (!$_loop_count) { - SHOW BINLOG EVENTS; + --source include/show_rpl_debug_info.inc --die ERROR: failed while waiting for $wait_binlog_event in binlog } real_sleep 0.1; diff --git a/mysql-test/include/wait_for_slave_io_error.inc b/mysql-test/include/wait_for_slave_io_error.inc index 094406e02b2..34cbf20a73b 100644 --- a/mysql-test/include/wait_for_slave_io_error.inc +++ b/mysql-test/include/wait_for_slave_io_error.inc @@ -1,23 +1,59 @@ # ==== Purpose ==== # # Waits until the IO thread of the current connection has got an -# error, or until a timeout is reached. +# error, or until a timeout is reached. Also waits until the IO +# thread has completely stopped. # # ==== Usage ==== # +# # Wait several errors. +# let $slave_io_errno= 1, 2, 3; # source include/wait_for_slave_io_error.inc; # -# Parameters to this macro are $slave_timeout and -# $slave_keep_connection. See wait_for_slave_param.inc for -# descriptions. +# # Print error message +# let $slave_io_errno= 1; +# let $show_slave_io_error= 1; +# source include/wait_for_slave_io_error.inc; +# +# Parameters: +# +# $slave_io_errno +# The expected IO error numbers. This is required. +# (After BUG#41956 has been fixed, this will be required to be a +# symbolic name instead of a numbers.) +# +# $show_slave_io_error +# If set, will print the error to the query log. +# +# $slave_timeout +# See wait_for_slave_param.inc for description. +# +# $master_connection +# See wait_for_slave_param.inc for description. -let $old_slave_param_comparison= $slave_param_comparison; +if (`SELECT '$slave_io_errno' = ''`) { + --die !!!ERROR IN TEST: you must set \$slave_io_errno before sourcing wait_for_slave_io_error.inc +} +let $old_slave_param_comparison= $slave_param_comparison; let $slave_param= Last_IO_Errno; let $slave_param_comparison= !=; let $slave_param_value= 0; let $slave_error_message= Failed while waiting for slave to produce an error in its sql thread; source include/wait_for_slave_param.inc; let $slave_error_message= ; - let $slave_param_comparison= $old_slave_param_comparison; + +let $_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1); +if (`SELECT $_error NOT IN ($slave_io_errno)`) { + --echo **** Slave stopped with wrong error code: $_error (expected $slave_io_errno) **** + source include/show_rpl_debug_info.inc; + --echo **** Slave stopped with wrong error code: $_error (expected $slave_io_errno) **** + --die Slave stopped with wrong error code +} + +if ($show_slave_io_error) +{ + let $error= query_get_value("SHOW SLAVE STATUS", Last_IO_Error, 1); + echo Last_IO_Error = $error; +} diff --git a/mysql-test/include/wait_for_slave_param.inc b/mysql-test/include/wait_for_slave_param.inc index 1e690bdfe9c..b0989c3264e 100644 --- a/mysql-test/include/wait_for_slave_param.inc +++ b/mysql-test/include/wait_for_slave_param.inc @@ -80,5 +80,5 @@ if (!$_slave_timeout_counter) --echo Current connection is '$CURRENT_CONNECTION' echo Note: the following output may have changed since the failure was detected; source include/show_rpl_debug_info.inc; - exit; + die; } diff --git a/mysql-test/include/wait_for_slave_sql_error.inc b/mysql-test/include/wait_for_slave_sql_error.inc index ad1d7a9e639..aab04036eea 100644 --- a/mysql-test/include/wait_for_slave_sql_error.inc +++ b/mysql-test/include/wait_for_slave_sql_error.inc @@ -14,6 +14,9 @@ # The expected SQL error number. This is required. # (After BUG#41956 has been fixed, this will be required to be a # symbolic name instead of a number.) +# +# $show_slave_sql_error +# If set, will print the error to the query log. # # $slave_timeout # See wait_for_slave_param.inc for description. @@ -22,8 +25,7 @@ # See wait_for_slave_param.inc for description. if (`SELECT '$slave_sql_errno' = ''`) { - --echo !!!ERROR IN TEST: you must set \$slave_sql_errno before sourcing wait_fro_slave_sql_error.inc - exit; + --die !!!ERROR IN TEST: you must set \$slave_sql_errno before sourcing wait_for_slave_sql_error.inc } let $slave_param= Slave_SQL_Running; @@ -33,7 +35,14 @@ source include/wait_for_slave_param.inc; let $_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1); if (`SELECT '$_error' != '$slave_sql_errno'`) { - --echo Slave stopped with wrong error code: $_error (expected $slave_sql_errno) + --echo **** Slave stopped with wrong error code: $_error (expected $slave_sql_errno) **** source include/show_rpl_debug_info.inc; - exit; + --echo **** Slave stopped with wrong error code: $_error (expected $slave_sql_errno) **** + --die Slave stopped with wrong error code +} + +if ($show_slave_sql_error) +{ + let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); + echo Last_SQL_Error = $error; } diff --git a/mysql-test/include/wait_for_slave_sql_error_and_skip.inc b/mysql-test/include/wait_for_slave_sql_error_and_skip.inc index 247de3a41a1..11c02c0b490 100644 --- a/mysql-test/include/wait_for_slave_sql_error_and_skip.inc +++ b/mysql-test/include/wait_for_slave_sql_error_and_skip.inc @@ -22,17 +22,30 @@ # # $master_connection # See wait_for_slave_param.inc for description. +# +# $slave_skip_counter +# If set, skip this number of events. If not set, skip one event. +# +# $not_switch_connection If set, don't switch to slave and don't switch back +# master. +# echo --source include/wait_for_slave_sql_error_and_skip.inc; -connection slave; -source include/wait_for_slave_sql_error.inc; -if ($show_sql_error) +if (!$not_switch_connection) { - let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); - echo Last_SQL_Error = $error; + connection slave; } +source include/wait_for_slave_sql_error.inc; # skip the erroneous statement -set global sql_slave_skip_counter=1; +if ($slave_skip_counter) { + eval SET GLOBAL SQL_SLAVE_SKIP_COUNTER= $slave_skip_counter; +} +if (!$slave_skip_counter) { + SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; +} source include/start_slave.inc; -connection master; +if (!$not_switch_connection) +{ + connection master; +} diff --git a/mysql-test/include/wait_for_status_var.inc b/mysql-test/include/wait_for_status_var.inc index 4c168da7f1a..8b644c2c3c5 100644 --- a/mysql-test/include/wait_for_status_var.inc +++ b/mysql-test/include/wait_for_status_var.inc @@ -35,7 +35,7 @@ if (`SELECT STRCMP('$status_type', '') * STRCMP(UPPER('$status_type'), 'SESSION') * STRCMP(UPPER('$status_type'), 'GLOBAL')`) { --echo **** ERROR: Unknown type of variable status_type: allowed values are: SESSION or GLOBAL **** - exit; + die; } let $_status_timeout_counter= $status_timeout; @@ -60,7 +60,7 @@ while (`SELECT NOT('$_show_status_value' $_status_var_comparsion '$status_var_va --echo **** Showing STATUS, PROCESSLIST **** eval SHOW $status_type STATUS LIKE '$status_var'; SHOW PROCESSLIST; - exit; + die; } dec $_status_timeout_counter; sleep 0.1; diff --git a/mysql-test/include/wait_until_count_sessions.inc b/mysql-test/include/wait_until_count_sessions.inc index de4f0eeb652..26b0d8f2633 100644 --- a/mysql-test/include/wait_until_count_sessions.inc +++ b/mysql-test/include/wait_until_count_sessions.inc @@ -122,5 +122,6 @@ if (!$success) --echo # Timeout in wait_until_count_sessions.inc --echo # Number of sessions expected: <= $count_sessions found: $current_sessions SHOW PROCESSLIST; + --die Timeout in wait_until_count_sessions.inc } |