~ubuntu-branches/ubuntu/wily/mysql-5.6/wily

« back to all changes in this revision

Viewing changes to mysql-test/suite/rpl/t/rpl_low_slave_net_time_out.test

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2015-04-16 20:07:10 UTC
  • mto: (1.3.9 vivid-proposed)
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: package-import@ubuntu.com-20150416200710-pcrsa022082zj46k
Tags: upstream-5.6.24
ImportĀ upstreamĀ versionĀ 5.6.24

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
###############################################################################
 
2
# Bug #19975697 SLAVE IO_THREAD MAY GET STUCK WHEN USING GTID AND LOW
 
3
# SLAVE_NET_TIMEOUTS
 
4
#
 
5
# Problem: Dump thread is not checking the necessity of heartbeat event
 
6
#  while it is scanning through the binary log files and skipping some groups
 
7
#  which were already present at Slave.
 
8
# Fix: Dump thread will check whether it is time to send an heartbeat event or
 
9
#  not before skipping an event. If so, it will send one to Slave.
 
10
###############################################################################
 
11
 
 
12
--source include/have_binlog_format_statement.inc
 
13
--source include/have_gtid.inc
 
14
--source include/have_debug_sync.inc
 
15
--source include/force_restart.inc
 
16
# Problem is reproduced only with gtid auto position protocol
 
17
--let $use_gtids=1
 
18
--let $rpl_skip_start_slave=1;
 
19
--source include/master-slave.inc
 
20
 
 
21
# set slave_net_timeout to 10 seconds and then start slave threads
 
22
--connection slave
 
23
CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD=5;
 
24
SET @save_old_slave_net_timeout=@@global.slave_net_timeout;
 
25
SET @@global.slave_net_timeout=10;
 
26
--source include/start_slave.inc
 
27
# In order to reproduce the bug with a smaller test data,
 
28
# inject 2 seconds delay after an skipped event.
 
29
--connection master
 
30
SET @save_debug=@@global.debug;
 
31
SET GLOBAL DEBUG='+d,inject_2sec_sleep_when_skipping_an_event';
 
32
 
 
33
# Have some gtid transactions in binary log
 
34
# Below create and two insert statements would have created '6' sub events
 
35
#  # GTID 1
 
36
#  # CREATE
 
37
#  # GTID 2
 
38
#  # BEGIN
 
39
#  # INSERT
 
40
#  # COMMIT
 
41
#
 
42
CREATE TABLE t1(i INT) engine=innodb;
 
43
INSERT INTO t1 VALUES (1);
 
44
 
 
45
# Sync it with Slave
 
46
--source include/sync_slave_sql_with_master.inc
 
47
 
 
48
# Stop the Replication
 
49
--source include/stop_slave.inc
 
50
 
 
51
# Create another gtid transaction at Master
 
52
--connection master
 
53
# Also, we introduce 'hold_dump_thread_inside_inner_loop' debug simulation now
 
54
# to see what happens if dump thread is killed when the logic is
 
55
# in inner while loop. The server code resets this debug point
 
56
# after it is trigged once. So the sync of the following 'drop table'
 
57
# statement will happen with the second dump thread that will be created
 
58
# after slave triggers for another dump request after slave_net_timeout(10)
 
59
# seconds.
 
60
--source include/stop_dump_threads.inc
 
61
SET GLOBAL DEBUG='+d,hold_dump_thread_inside_inner_loop';
 
62
DROP TABLE t1;
 
63
# Start the Replication
 
64
# This will create a dump thread on Master and because of
 
65
# debug point, it will wait in inner loop.
 
66
--connection slave
 
67
--source include/start_slave.inc
 
68
 
 
69
--connection master
 
70
SET DEBUG_SYNC='now WAIT_FOR signal_inside_inner_loop';
 
71
 
 
72
# When a dump thread is waiting inside inner loop,
 
73
# restart slave threads which will kill the existing
 
74
# dump thread and will recreate it.
 
75
--connection slave
 
76
--source include/stop_slave.inc
 
77
 
 
78
# Reset debug point for the next dump thread to ignore it
 
79
--connection master
 
80
SET GLOBAL DEBUG='-d,hold_dump_thread_inside_inner_loop';
 
81
 
 
82
# Start slave thread
 
83
--connection slave
 
84
--source include/start_slave.inc
 
85
 
 
86
# Signal the zombie dump thread to go ahead.
 
87
--connection master
 
88
SET DEBUG_SYNC='now signal signal_continue';
 
89
 
 
90
# Now Dump thread-I/O thread communitcation protocol will detect that
 
91
# it does not have recent gtid transaction(drop table) and Master
 
92
# should send that transaction to Slave. This detection will take
 
93
# 12 seconds because of the injected 2 seconds delay after every skipped
 
94
# event (Please see above) which is more than the slave_net_timeout.
 
95
# But now, after the fix, the server will check for necessity of sending an
 
96
# heartbeat event even while it is skipping the events, the below
 
97
# sync should not be timed out after the fix.
 
98
--connection master
 
99
--source include/sync_slave_sql_with_master.inc
 
100
 
 
101
# Cleanup
 
102
--connection master
 
103
SET GLOBAL DEBUG=@save_debug;
 
104
--connection slave
 
105
SET @@global.slave_net_timeout=@save_old_slave_net_timeout;
 
106
--source include/rpl_end.inc