1
###############################################################################
2
# Bug #19975697 SLAVE IO_THREAD MAY GET STUCK WHEN USING GTID AND LOW
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
###############################################################################
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
18
--let $rpl_skip_start_slave=1;
19
--source include/master-slave.inc
21
# set slave_net_timeout to 10 seconds and then start slave threads
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.
30
SET @save_debug=@@global.debug;
31
SET GLOBAL DEBUG='+d,inject_2sec_sleep_when_skipping_an_event';
33
# Have some gtid transactions in binary log
34
# Below create and two insert statements would have created '6' sub events
42
CREATE TABLE t1(i INT) engine=innodb;
43
INSERT INTO t1 VALUES (1);
46
--source include/sync_slave_sql_with_master.inc
48
# Stop the Replication
49
--source include/stop_slave.inc
51
# Create another gtid transaction at 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)
60
--source include/stop_dump_threads.inc
61
SET GLOBAL DEBUG='+d,hold_dump_thread_inside_inner_loop';
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.
67
--source include/start_slave.inc
70
SET DEBUG_SYNC='now WAIT_FOR signal_inside_inner_loop';
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.
76
--source include/stop_slave.inc
78
# Reset debug point for the next dump thread to ignore it
80
SET GLOBAL DEBUG='-d,hold_dump_thread_inside_inner_loop';
84
--source include/start_slave.inc
86
# Signal the zombie dump thread to go ahead.
88
SET DEBUG_SYNC='now signal signal_continue';
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.
99
--source include/sync_slave_sql_with_master.inc
103
SET GLOBAL DEBUG=@save_debug;
105
SET @@global.slave_net_timeout=@save_old_slave_net_timeout;
106
--source include/rpl_end.inc