~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# BUG#45214
 
3
# The common part of the "rpl_get_master_version_and_clock" test. 
 
4
# Restart slave under network disconnection between slave and master
 
5
# following the steps:
 
6
#    1 - Got DBUG_SYNC_POINT lock
 
7
#    2 - Set DBUG_SYNC_POINT before call mysql_real_query(...) function in get_master_version_and_clock(...) function and hang here
 
8
#    3 - shutdown master server for simulating network disconnection
 
9
#    4 - Release DBUG_SYNC_POINT lock
 
10
#    5 - Check if the slave I/O thread tries to reconnect to master. 
 
11
#
 
12
# Note: Please make sure initialize the $debug_lock when call the test script.
 
13
#
 
14
connection slave;
 
15
if (`SELECT '$debug_lock' = ''`)
 
16
{
 
17
    --die Cannot continue. Please set value for $debug_lock.
 
18
}
 
19
 
 
20
# Restart slave
 
21
--disable_warnings
 
22
stop slave;
 
23
source include/wait_for_slave_to_stop.inc;
 
24
start slave;
 
25
source include/wait_for_slave_to_start.inc;
 
26
connection master;
 
27
# Write file to make mysql-test-run.pl expect the "crash", but don't start
 
28
# it until it's told to
 
29
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
 
30
wait
 
31
EOF
 
32
 
 
33
# Send shutdown to the connected server and give
 
34
# it 10 seconds to die before zapping it
 
35
shutdown_server 10;
 
36
 
 
37
connection slave;
 
38
eval SELECT RELEASE_LOCK($debug_lock);
 
39
 
 
40
# Show slave last IO errno
 
41
connection slave;
 
42
source include/wait_for_slave_io_error.inc;
 
43
let $last_io_errno= query_get_value("show slave status", Last_IO_Errno, 1);
 
44
--echo Check network error happened here
 
45
if (`SELECT '$last_io_errno' = '2013' || # CR_SERVER_LOST
 
46
            '$last_io_errno' = '2003' || # CR_CONN_HOST_ERROR
 
47
            '$last_io_errno' = '2002' || # CR_CONNECTION_ERROR
 
48
            '$last_io_errno' = '2006' || # CR_SERVER_GONE_ERROR
 
49
            '$last_io_errno' = '1040' || # ER_CON_COUNT_ERROR
 
50
            '$last_io_errno' = '1053'    # ER_SERVER_SHUTDOWN
 
51
            `)
 
52
{
 
53
  --echo NETWORK ERROR
 
54
}
 
55
 
 
56
# Write file to make mysql-test-run.pl start up the server again
 
57
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
 
58
restart
 
59
EOF
 
60
 
 
61
connection master;
 
62
# Turn on reconnect
 
63
--enable_reconnect
 
64
 
 
65
# Call script that will poll the server waiting for it to be back online again
 
66
--source include/wait_until_connected_again.inc
 
67
 
 
68
# Turn off reconnect again
 
69
--disable_reconnect
 
70
 
 
71
connection slave;
 
72
source include/wait_for_slave_to_start.inc;
 
73