summaryrefslogtreecommitdiff
path: root/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test')
-rw-r--r--mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test63
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;
+