1#
2# Whenever the mysql_binlog_send method (dump thread) reaches the
3# end of file when reading events from the binlog, before checking
4# if it should wait for more events, there was a test to check if
5# the file being read was still active, i.e, it was the last known
6# binlog. However, it was possible that something was written to
7# the binary log and then a rotation would happen, after EOF was
8# detected and before the check for active was performed. In this
9# case, the end of the binary log would not be read by the dump
10# thread, and this would cause the slave to lose updates.
11#
12# This test verifies that the problem has been fixed. It waits
13# during this window while forcing a rotation in the binlog.
14#
15--source include/have_debug.inc
16--source include/master-slave.inc
17
18--connection master
19
20SET @debug_saved= @@GLOBAL.DEBUG_DBUG;
21
22CREATE TABLE t (i INT);
23
24# When reaching the EOF the dump thread will wait before deciding if
25# it should move to a new binlong file.
26SET GLOBAL DEBUG_DBUG= "d,wait_after_binlog_EOF";
27
28INSERT INTO t VALUES (1);
29
30--sleep 1
31
32# A insert and a rotate happens before the decision
33INSERT INTO t VALUES (2);
34FLUSH LOGS;
35
36SET DEBUG_SYNC= 'now SIGNAL signal.rotate_finished';
37
38--sync_slave_with_master
39
40# All the rows should be sent to the slave.
41--let $diff_tables=master:t,slave:t
42--source include/diff_tables.inc
43
44##Clean up
45--connection master
46
47SET @@GLOBAL.DEBUG_DBUG= @debug_saved;
48SET DEBUG_SYNC= 'RESET';
49
50DROP TABLE t;
51--source include/rpl_end.inc
52