| 1 |
############################################################################### |
| 2 |
# Bug #19975697 SLAVE IO_THREAD MAY GET STUCK WHEN USING GTID AND LOW |
| 3 |
# REPLICA_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_debug_sync.inc |
| 14 |
--source include/force_restart.inc |
| 15 |
# Problem is reproduced only with gtid auto position protocol |
| 16 |
--let $use_gtids=1 |
| 17 |
--let $rpl_skip_start_slave=1; |
| 18 |
--source include/master-slave.inc |
| 19 |
|
| 20 |
# set replica_net_timeout to 10 seconds and then start slave threads |
| 21 |
--connection slave |
| 22 |
CHANGE REPLICATION SOURCE TO SOURCE_HEARTBEAT_PERIOD=5; |
| 23 |
SET @save_old_replica_net_timeout=@@global.replica_net_timeout; |
| 24 |
SET @@global.replica_net_timeout=10; |
| 25 |
--source include/start_slave.inc |
| 26 |
# In order to reproduce the bug with a smaller test data, |
| 27 |
# inject 2 seconds delay after an skipped event. |
| 28 |
--connection master |
| 29 |
SET @save_debug=@@global.debug; |
| 30 |
SET GLOBAL DEBUG='+d,inject_2sec_sleep_when_skipping_an_event'; |
| 31 |
|
| 32 |
# Have some gtid transactions in binary log |
| 33 |
# Below create and two insert statements would have created '6' sub events |
| 34 |
# # GTID 1 |
| 35 |
# # CREATE |
| 36 |
# # GTID 2 |
| 37 |
# # BEGIN |
| 38 |
# # INSERT |
| 39 |
# # COMMIT |
| 40 |
# |
| 41 |
CREATE TABLE t1(i INT) engine=innodb; |
| 42 |
INSERT INTO t1 VALUES (1); |
| 43 |
|
| 44 |
# Sync it with Slave |
| 45 |
--source include/sync_slave_sql_with_master.inc |
| 46 |
|
| 47 |
# Stop the Replication |
| 48 |
--source include/stop_slave.inc |
| 49 |
|
| 50 |
# Create another gtid transaction at Master |
| 51 |
--connection master |
| 52 |
DROP TABLE t1; |
| 53 |
|
| 54 |
# Start slave thread |
| 55 |
--connection slave |
| 56 |
--source include/start_slave.inc |
| 57 |
|
| 58 |
# Now Dump thread-I/O thread communitcation protocol will detect that |
| 59 |
# it does not have recent gtid transaction(drop table) and Master |
| 60 |
# should send that transaction to Slave. This detection will take |
| 61 |
# 12 seconds because of the injected 2 seconds delay after every skipped |
| 62 |
# event (Please see above) which is more than the replica_net_timeout. |
| 63 |
# But now, after the fix, the server will check for necessity of sending an |
| 64 |
# heartbeat event even while it is skipping the events, the below |
| 65 |
# sync should not be timed out after the fix. |
| 66 |
--connection master |
| 67 |
--source include/sync_slave_sql_with_master.inc |
| 68 |
|
| 69 |
# Cleanup |
| 70 |
--connection master |
| 71 |
SET GLOBAL DEBUG=@save_debug; |
| 72 |
--connection slave |
| 73 |
SET @@global.replica_net_timeout=@save_old_replica_net_timeout; |
| 74 |
--source include/rpl_end.inc |