summaryrefslogtreecommitdiff
path: root/mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test
blob: 181759283e23b97ebfb28e6ff486e3755efabb53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#
# 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:
#    0 - Set DEBUG_SYNC_ACTION to wait 
#        before call mysql_real_query(...) function in get_master_version_and_clock(...)
#        function and hang here
#    1 - activate a sync-point through the $dbug_sync_point argument of the test
#    2 - shutdown master server for simulating network disconnection
#    3 - signal to the IO thread through $debug_sync_action to unhold from the sync-point
#    4 - check if the slave I/O thread tries to reconnect to master. 
#
# Note: make sure to initialize the $debug_sync_action and $dbug_sync_point
#       before calling the test script.
#
# Pattern of usage:
#
# The caller test supplies the DBUG_EXECUTE_IF name
#
#    let $dbug_sync_point = 'dbug_execute_if_name';
#
# as well as the action list for DEBUG_SYNC
#    
#    let $debug_sync_action= 'now signal signal_name';
#
# The $dbug_sync_point becomes the value of @@global.debug generating
# a newly started IO-slave thread's session value.
# Notice incremental operations to add and remove dbug_execute_if_name
# from the global variable allows propagation more dbug arguments
# out of mtr.
# The action list is to fire at proper time according to test logics
# (see pp 0-4 above).
#

connection slave;
if (!$debug_sync_action)
{
    --die Cannot continue. Please set value for debug_sync_action.
}

# Restart slave
--source include/stop_slave.inc
SET @old_dbug = @@global.debug_dbug;
eval SET @@global.debug_dbug= "d,$dbug_sync_point";

--source include/start_slave.inc
--echo slave is going to hang in get_master_version_and_clock

--let $rpl_server_number= 1
--source include/rpl_stop_server.inc

--echo slave is unblocked

eval SET DEBUG_SYNC=$debug_sync_action;

# Show slave last IO errno
connection slave;
--echo Check network error happened here
# '2013' CR_SERVER_LOST 
# '2003' CR_CONN_HOST_ERROR 
# '2002' CR_CONNECTION_ERROR 
# '2006' CR_SERVER_GONE_ERROR 
# '1053' ER_SERVER_SHUTDOWN
let $slave_io_errno= 1053, 2002, 2003, 2006, 2013;
--let $slave_io_error_is_nonfatal= 1
source include/wait_for_slave_io_error.inc;

# deactivate the sync point of get_master_version_and_clock()
# now to avoid restarting IO-thread to re-enter it.
# There will be a new IO thread forked out with its @@session.debug
# unset.
set @@global.debug_dbug= @old_dbug;

--let $rpl_server_number= 1
--source include/rpl_start_server.inc

# We don't source include/wait_for_slave_io_to_start.inc, because the
# IO thread has an error and wait_for_slave_io_to_start.inc fails if
# the IO thread has an error.
--let $slave_param= Slave_IO_Running
--let $slave_param_value= Yes
--source include/wait_for_slave_param.inc