1# MDEV-14721 Big transaction events get lost on semisync master when
2# replicate_events_marked_for_skip=FILTER_ON_MASTER
3#
4# When events of a big transaction are binlogged offsetting over 2GB from
5# the beginning of the log the semisync master's dump thread
6# lost such events.
7# The test verifies the fixes' correctness simulating the 2GB offset.
8
9source include/not_embedded.inc;
10source include/have_innodb.inc;
11source include/have_debug.inc;
12source include/master-slave.inc;
13
14--connection master
15# Suppress warnings that might be generated during the test
16call mtr.add_suppression("Timeout waiting for reply of binlog");
17
18--let $sav_enabled_master=`SELECT @@GLOBAL.rpl_semi_sync_master_enabled`
19--let $sav_timeout_master=`SELECT @@GLOBAL.rpl_semi_sync_master_timeout`
20SET @@GLOBAL.rpl_semi_sync_master_enabled = 1;
21SET @@GLOBAL.rpl_semi_sync_master_timeout=100;
22
23--connection slave
24--let $sav_skip_marked_slave=`SELECT @@GLOBAL.replicate_events_marked_for_skip`
25--let $sav_enabled_slave=`SELECT @@GLOBAL.rpl_semi_sync_slave_enabled`
26source include/stop_slave.inc;
27SET @@GLOBAL.replicate_events_marked_for_skip=FILTER_ON_MASTER;
28SET @@GLOBAL.rpl_semi_sync_slave_enabled = 1;
29source include/start_slave.inc;
30
31--connection master
32CREATE TABLE t1 (a INT) ENGINE=innodb;
33
34# Make the following events as if they offset over 2GB from the beginning of binlog
35SET @saved_dbug = @@GLOBAL.debug_dbug;
36SET @@GLOBAL.debug_dbug="d,dbug_master_binlog_over_2GB";
37SET @@SESSION.skip_replication=1;
38INSERT INTO t1 SET a=1;
39SET @@SESSION.skip_replication=0;
40INSERT INTO t1 SET a=0;
41SET @@GLOBAL.debug_dbug="";
42
43# The current binlog is inconsistent so let's rotate it away
44# to clean up simulation results.
45FLUSH LOGS;
46
47--sync_slave_with_master
48
49#
50# Clean up
51#
52--connection master
53SET @@GLOBAL.debug_dbug = @saved_dbug;
54--eval SET @@GLOBAL.rpl_semi_sync_master_timeout = $sav_timeout_master
55--eval SET @@GLOBAL.rpl_semi_sync_master_enabled = $sav_enabled_master
56
57--connection master
58DROP TABLE t1;
59
60--sync_slave_with_master
61source include/stop_slave.inc;
62--eval SET @@GLOBAL.rpl_semi_sync_slave_enabled = $sav_enabled_slave
63--eval SET @@GLOBAL.replicate_events_marked_for_skip = $sav_skip_marked_slave
64
65source include/start_slave.inc;
66--source include/rpl_end.inc
67