diff options
author | He Zhenxing <zhenxing.he@sun.com> | 2009-03-05 18:10:44 +0800 |
---|---|---|
committer | He Zhenxing <zhenxing.he@sun.com> | 2009-03-05 18:10:44 +0800 |
commit | b4fdb8aec14b533db4a5ea2f99c1a9f3ce07946c (patch) | |
tree | c6ec33b757dfff8d69335ab97419c2842f1f61cb /mysql-test/include | |
parent | 62d5d85c5d19b113b772ecadbf32f198831b543b (diff) | |
download | mariadb-git-b4fdb8aec14b533db4a5ea2f99c1a9f3ce07946c.tar.gz |
BUG#37051 Replication rules not evaluated correctly
Backporting patch to 5.0.
Diffstat (limited to 'mysql-test/include')
-rw-r--r-- | mysql-test/include/master-slave-end.inc | 6 | ||||
-rw-r--r-- | mysql-test/include/start_slave.inc | 21 | ||||
-rw-r--r-- | mysql-test/include/stop_slave.inc | 21 | ||||
-rw-r--r-- | mysql-test/include/wait_for_slave_sql_error.inc | 40 | ||||
-rw-r--r-- | mysql-test/include/wait_for_slave_sql_error_and_skip.inc | 39 |
5 files changed, 127 insertions, 0 deletions
diff --git a/mysql-test/include/master-slave-end.inc b/mysql-test/include/master-slave-end.inc new file mode 100644 index 00000000000..74e4c7b608a --- /dev/null +++ b/mysql-test/include/master-slave-end.inc @@ -0,0 +1,6 @@ +--connection master +--sync_slave_with_master +--connection slave +--disable_query_log +STOP SLAVE; +--enable_query_log diff --git a/mysql-test/include/start_slave.inc b/mysql-test/include/start_slave.inc new file mode 100644 index 00000000000..78a02736de8 --- /dev/null +++ b/mysql-test/include/start_slave.inc @@ -0,0 +1,21 @@ +# ==== Purpose ==== +# +# Issues START SLAVE on the current connection. Then waits until both +# the IO and SQL threads have started, or until a timeout is reached. +# +# Please use this instead of 'START SLAVE', to reduce the risk of test +# case bugs. +# +# ==== Usage ==== +# +# source include/wait_for_slave_to_start.inc; +# +# Parameters to this macro are $slave_timeout and +# $master_connection. See wait_for_slave_param.inc for +# descriptions. + +--disable_query_log +START SLAVE; +--enable_query_log +--echo include/start_slave.inc +source include/wait_for_slave_to_start.inc; diff --git a/mysql-test/include/stop_slave.inc b/mysql-test/include/stop_slave.inc new file mode 100644 index 00000000000..7161e6fe739 --- /dev/null +++ b/mysql-test/include/stop_slave.inc @@ -0,0 +1,21 @@ +# ==== Purpose ==== +# +# Issues STOP SLAVE on the current connection. Then waits until both +# the IO and SQL threads have stopped, or until a timeout is reached. +# +# Please use this instead of 'STOP SLAVE', to reduce the risk of test +# case bugs. +# +# ==== Usage ==== +# +# source include/wait_for_slave_to_start.inc; +# +# Parameters to this macro are $slave_timeout and +# $master_connection. See wait_for_slave_param.inc for +# descriptions. + +--disable_query_log +STOP SLAVE; +--enable_query_log +--echo include/stop_slave.inc +source include/wait_for_slave_to_stop.inc; diff --git a/mysql-test/include/wait_for_slave_sql_error.inc b/mysql-test/include/wait_for_slave_sql_error.inc new file mode 100644 index 00000000000..1a708cee780 --- /dev/null +++ b/mysql-test/include/wait_for_slave_sql_error.inc @@ -0,0 +1,40 @@ +# ==== Purpose ==== +# +# Waits until the SQL thread of the current connection has got an +# error, or until a timeout is reached. Also waits until the SQL +# thread has completely stopped. +# +# ==== Usage ==== +# +# source include/wait_for_slave_sql_error.inc; +# +# Parameters: +# +# $slave_sql_errno +# 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.) +# +# $slave_timeout +# See wait_for_slave_param.inc for description. +# +# $master_connection +# 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; +} + +let $slave_param= Slave_SQL_Running; +let $slave_param_value= No; +let $slave_error_message= Failed while waiting for slave to stop the SQL thread (expecting error in the SQL thread); +source include/wait_for_slave_param.inc; + +# NOTE: on mysql-5.0, there is no way to distinguish slave SQL error from IO error +let $_error= query_get_value(SHOW SLAVE STATUS, Last_Errno, 1); +if (`SELECT '$_error' != '$slave_sql_errno'`) { + --echo Slave stopped with wrong error code: $_error (expected $slave_sql_errno) + source include/show_rpl_debug_info.inc; + exit; +} 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 new file mode 100644 index 00000000000..5723720f4b7 --- /dev/null +++ b/mysql-test/include/wait_for_slave_sql_error_and_skip.inc @@ -0,0 +1,39 @@ +# ==== Purpose ==== +# +# Wait for slave SQL error, skip the erroneous statement and restart +# slave +# +# ==== Usage ==== +# +# let $slave_sql_error= <ERRNO>; +# source include/wait_for_slave_sql_error_and_skip.inc; +# +# Parameters: +# +# $slave_sql_errno +# The error number to wait for. This is required. (See +# wait_for_slave_sql_error.inc) +# +# $show_sql_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. + +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) +{ + # NOTE: on mysql-5.0, there is no way to distinguish slave SQL error from IO error + let $error= query_get_value("SHOW SLAVE STATUS", Last_Error, 1); + echo Last_SQL_Error = $error; +} + +# skip the erroneous statement +set global sql_slave_skip_counter=1; +source include/start_slave.inc; +connection master; |