diff options
author | unknown <Dao-Gang.Qu@sun.com> | 2009-07-16 14:56:43 +0800 |
---|---|---|
committer | unknown <Dao-Gang.Qu@sun.com> | 2009-07-16 14:56:43 +0800 |
commit | aa4b8939a0ccc47e40e97af10b151f139e887b65 (patch) | |
tree | fd56e1a55c360340d0696cfda82bf3f850a028ff /mysql-test/extra | |
parent | 5f9440d2a628b8f78ce4f172a2028f2749800639 (diff) | |
download | mariadb-git-aa4b8939a0ccc47e40e97af10b151f139e887b65.tar.gz |
Bug #45214 get_master_version_and_clock does not report error when queries fail
The "get_master_version_and_clock(...)" function in sql/slave.cc ignores
error and passes directly when queries fail, or queries succeed
but the result retrieved is empty.
The "get_master_version_and_clock(...)" function should try to reconnect master
if queries fail because of transient network problems, and fail otherwise.
The I/O thread should print a warning if the some system variables do not
exist on master (very old master)
mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test:
Added test file for bug #45214
mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result:
Added test result for bug #45214
mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test:
Added test file for bug #45214
sql/slave.cc:
The 'is_network_error()' function is added for checking if the error is caused by network.
Added a new return value (2) to 'get_master_version_and_clock()' function result set
to indicate transient network errors when queries fail, and the caller should
try to reconnect in this case.
Diffstat (limited to 'mysql-test/extra')
-rw-r--r-- | mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test b/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test new file mode 100644 index 00000000000..c79ccdd044f --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test @@ -0,0 +1,63 @@ +# +# BUG#45214 +# The common part of the "rpl_get_master_version_and_clock" test. +# Restart slave under network disconnection between slave and master +# following the steps: +# 1 - Got DBUG_SYNC_POINT lock +# 2 - Set DBUG_SYNC_POINT before call mysql_real_query(...) function in get_master_version_and_clock(...) function and hang here +# 3 - shutdown master server for simulating network disconnection +# 4 - Release DBUG_SYNC_POINT lock +# 5 - Check if the slave I/O thread tries to reconnect to master. +# +# Note: Please make sure initialize the $debug_lock when call the test script. +# +connection slave; +if (`SELECT '$debug_lock' = ''`) +{ + --die Cannot continue. Please set value for $debug_lock. +} + +# Restart slave +--disable_warnings +stop slave; +source include/wait_for_slave_to_stop.inc; +start slave; +source include/wait_for_slave_to_start.inc; +connection master; +# Write file to make mysql-test-run.pl expect the "crash", but don't start +# it until it's told to +--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +wait +EOF + +# Send shutdown to the connected server and give +# it 10 seconds to die before zapping it +shutdown_server 10; + +connection slave; +eval SELECT RELEASE_LOCK($debug_lock); + +# Show slave last IO errno +connection slave; +source include/wait_for_slave_io_error.inc; +let $last_io_errno= query_get_value("show slave status", Last_IO_Errno, 1); +echo Slave_IO_Errno= $last_io_errno; + +# Write file to make mysql-test-run.pl start up the server again +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +restart +EOF + +connection master; +# Turn on reconnect +--enable_reconnect + +# Call script that will poll the server waiting for it to be back online again +--source include/wait_until_connected_again.inc + +# Turn off reconnect again +--disable_reconnect + +connection slave; +source include/wait_for_slave_to_start.inc; + |