Debian Codegraph @

mysql-test/suite/rpl/t/rpl_heartbeat_at_rotate.test

raw
1 #
2 # Test ensures that a heartbeat event can be replicated from master to slave
3 # during a slow rotation. MDEV-29981 reported two bugs where the slave could
4 # stop in error during a slow rotation because of incorrect checks.
5 #
6 # To simulate a slow rotation, this test pauses (via debug_sync) after a rotate
7 # event has been written and synced to disk, but before the new binary log has
8 # been created. After the rotate event has been received and processed by the
9 # slave, the test then waits for the next heartbeat event to be sent to the
10 # slave. Once the heartbeat has been sent, the rotation is completed, and then
11 # the test ensures replication is ok by creating transactions and ensuring they
12 # are able to be replicated by the slave. Note that the heartbeat period is set
13 # to 2 seconds.
14 #
15 #
16 # References:
17 # MDEV-29881: Replica stops with "Found invalid event in binary log"
18 #
19 --source include/have_debug.inc
20 --source include/have_debug_sync.inc
21 --source include/have_innodb.inc
22
23 --echo # Binlog format independent
24 --source include/have_binlog_format_row.inc
25 --source include/master-slave.inc
26
27
28 --echo #
29 --echo # Initialize test data
30 --connection slave
31 --source include/stop_slave.inc
32 change master to master_heartbeat_period=2;
33 --source include/start_slave.inc
34
35 --echo # Rotating master logs and pausing after Rotate_event is written..
36 --connection master
37 set @old_dbug= @@global.debug_dbug;
38 set @@global.debug_dbug= "+d,stop_after_rotate_written";
39 --send flush binary logs
40
41 --echo # Waiting for Rotate event to write/sync to disk
42 --connection server_1
43 set debug_sync="now wait_for rotate_written";
44
45 --echo # Sleep 3s so the master sends a heartbeat event to the slave
46 --sleep 3
47
48 --connection server_1
49 set debug_sync="now signal finish_rotate";
50
51 --connection master
52 --reap
53 set @@global.debug_dbug= @old_dbug;
54
55 --echo #
56 --echo # Ensure replication continues without error..
57 --connection master
58 create table t1 (a int);
59 insert into t1 values (1);
60 --sync_slave_with_master
61 --let $diff_tables=master:test.t1,slave:test.t1
62 --source include/diff_tables.inc
63
64
65 --echo #
66 --echo # Cleanup
67 --connection master
68 drop table t1;
69 --source include/save_master_gtid.inc
70
71 --connection slave
72 --source include/sync_with_master_gtid.inc
73
74 --source include/rpl_end.inc
75 --echo # End of rpl_heartbeat_at_rotate.test