1--source include/have_debug.inc
2--source include/have_debug_sync.inc
3--source include/have_binlog_format_row.inc
4--source include/have_innodb.inc
5--source include/master-slave.inc
6
7connection master;
8set @old_master_binlog_checksum= @@global.binlog_checksum;
9
10# MDEV-4475: Cannot replicate to old server when binlog contains
11# empty Gtid_list event
12#
13# Test this by binlog rotation before we log any GTIDs.
14connection slave;
15--source include/stop_slave.inc
16--echo # Test slave with no capability gets dummy event, which is ignored.
17set @old_dbug= @@global.debug_dbug;
18SET @@global.debug_dbug='+d,simulate_slave_capability_none';
19--source include/start_slave.inc
20
21connection master;
22FLUSH LOGS;
23CREATE TABLE t1 (a INT PRIMARY KEY);
24INSERT INTO t1 VALUES (0);
25sync_slave_with_master;
26
27connection master;
28# Add a dummy event just to have something to sync_slave_with_master on.
29# Otherwise we occasionally get different $relaylog_start, depending on
30# whether Format_description_log_event was written to relay log or not
31# at the time of SHOW SLAVE STATUS.
32ALTER TABLE t1 ORDER BY a;
33sync_slave_with_master;
34connection slave;
35let $relaylog_start= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1);
36
37connection master;
38SET SESSION binlog_annotate_row_events = ON;
39let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
40let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
41# A short event, to test when we need to use user_var_event for dummy event.
42DELETE FROM t1;
43INSERT INTO t1 /* A comment just to make the annotate event sufficiently long that the dummy event will need to get padded with spaces so that we can test that this works */ VALUES(1);
44let $binlog_limit= 0, 10;
45--source include/show_binlog_events.inc
46sync_slave_with_master;
47connection slave;
48
49SELECT * FROM t1;
50let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
51let $binlog_start= $relaylog_start;
52let $binlog_limit=0,10;
53--source include/show_relaylog_events.inc
54set @@global.debug_dbug= @old_dbug;
55
56--echo # Test dummy event is checksummed correctly.
57
58connection master;
59set @@global.binlog_checksum = CRC32;
60--source include/wait_for_binlog_checkpoint.inc
61TRUNCATE t1;
62let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
63let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
64INSERT INTO t1 VALUES(2);
65let $binlog_limit= 0, 5;
66--source include/show_binlog_events.inc
67sync_slave_with_master;
68connection slave;
69
70SELECT * FROM t1;
71let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
72let $binlog_start= 0;
73let $binlog_limit=7,5;
74--source include/show_relaylog_events.inc
75
76
77--echo *** MDEV-5754: MySQL 5.5 slaves cannot replicate from MariaDB 10.0 ***
78
79# The problem was that for a group commit, we get commit id into the
80# GTID event, and there was a bug in the code that replaces GTID with
81# dummy that failed when commit id was present.
82#
83# So setup a group commit in InnoDB.
84
85--connection master
86CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB;
87let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
88let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
89
90--connect (con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
91SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1';
92send INSERT INTO t2 VALUES (1);
93
94--connection master
95SET debug_sync='now WAIT_FOR master_queued1';
96
97--connect (con2,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
98SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued2';
99send INSERT INTO t2 VALUES (2);
100
101--connection master
102SET debug_sync='now WAIT_FOR master_queued2';
103SET debug_sync='now SIGNAL master_cont1';
104
105--connection con1
106REAP;
107SET debug_sync='RESET';
108--connection con2
109REAP;
110SET debug_sync='RESET';
111--connection master
112SET debug_sync='RESET';
113let $binlog_limit= 0, 10;
114--source include/show_binlog_events.inc
115--save_master_pos
116
117--connection slave
118--sync_with_master
119SELECT * FROM t2 ORDER BY a;
120
121
122--echo # Test that slave which cannot tolerate holes in binlog stream but
123--echo # knows the event does not get dummy event
124
125--source include/stop_slave.inc
126SET @@global.debug_dbug='+d,simulate_slave_capability_old_53';
127--source include/start_slave.inc
128connection master;
129ALTER TABLE t1 ORDER BY a;
130sync_slave_with_master;
131connection slave;
132let $relaylog_start= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1);
133
134connection master;
135let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
136let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
137UPDATE t1 SET a = 3;
138let $binlog_limit= 0, 5;
139--source include/show_binlog_events.inc
140sync_slave_with_master;
141connection slave;
142
143SELECT * FROM t1;
144let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
145let $binlog_start= $relaylog_start;
146let $binlog_limit=0,5;
147--source include/show_relaylog_events.inc
148
149select @@global.log_slave_updates;
150select @@global.replicate_annotate_row_events;
151
152--echo Clean up.
153connection master;
154set @@global.binlog_checksum = @old_master_binlog_checksum;
155DROP TABLE t1, t2;
156sync_slave_with_master;
157set @@global.debug_dbug= @old_dbug;
158--source include/rpl_end.inc
159