summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorNuno Carvalho <nuno.carvalho@oracle.com>2013-10-14 15:45:12 +0100
committerNuno Carvalho <nuno.carvalho@oracle.com>2013-10-14 15:45:12 +0100
commit3399194cefc7fcffcba4c304bbb3badec1afc21e (patch)
treedc8909fb7c5605b402c789a4d1c0c5ced4114a9b /mysql-test
parent8afade1a6866bd46bd6168f1b073ee6902fab0cf (diff)
downloadmariadb-git-3399194cefc7fcffcba4c304bbb3badec1afc21e.tar.gz
WL#7266: Dump-thread additional concurrency tests
This worklog aims at testing the two following scenarios: 1) Whenever the mysql_binlog_send method (dump thread) reaches the end of file when reading events from the binlog, before checking if it should wait for more events, there was a test to check if the file being read was still active, i.e, it was the last known binlog. However, it was possible that something was written to the binary log and then a rotation would happen, after EOF was detected and before the check for active was performed. In this case, the end of the binary log would not be read by the dump thread, and this would cause the slave to lose updates. This test verifies that the problem has been fixed. It waits during this window while forcing a rotation in the binlog. 2) Verify dump thread can send events in active file, correctly after encountering an IO error.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/suite/rpl/r/rpl_dump_events_twice_bug.result15
-rw-r--r--mysql-test/suite/rpl/r/rpl_lost_events_on_rotate.result14
-rw-r--r--mysql-test/suite/rpl/t/rpl_dump_events_twice_bug.test28
-rw-r--r--mysql-test/suite/rpl/t/rpl_lost_events_on_rotate.test51
4 files changed, 108 insertions, 0 deletions
diff --git a/mysql-test/suite/rpl/r/rpl_dump_events_twice_bug.result b/mysql-test/suite/rpl/r/rpl_dump_events_twice_bug.result
new file mode 100644
index 00000000000..8e6c8c122b5
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_dump_events_twice_bug.result
@@ -0,0 +1,15 @@
+include/master-slave.inc
+[connection master]
+CALL mtr.add_suppression("Failed to read an event from active binlog.*");
+SET @debug_saved= @@GLOBAL.DEBUG;
+CREATE TABLE t1(c1 INT);
+INSERT INTO t1 VALUES(1);
+[connection master]
+SET GLOBAL debug='+d,dump_fake_io_error';
+INSERT INTO t1 VALUES(2);
+INSERT INTO t1 VALUES(3);
+include/diff_tables.inc [master:t1, slave:t1]
+[connection master]
+SET @@GLOBAL.DEBUG= @debug_saved;
+DROP TABLE t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_lost_events_on_rotate.result b/mysql-test/suite/rpl/r/rpl_lost_events_on_rotate.result
new file mode 100644
index 00000000000..eee2effccea
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_lost_events_on_rotate.result
@@ -0,0 +1,14 @@
+include/master-slave.inc
+[connection master]
+SET @debug_saved= @@GLOBAL.DEBUG;
+CREATE TABLE t (i INT);
+SET GLOBAL DEBUG= "d,wait_after_binlog_EOF";
+INSERT INTO t VALUES (1);
+INSERT INTO t VALUES (2);
+FLUSH LOGS;
+SET DEBUG_SYNC= 'now SIGNAL signal.rotate_finished';
+include/diff_tables.inc [master:t,slave:t]
+SET @@GLOBAL.DEBUG= @debug_saved;
+SET DEBUG_SYNC= 'RESET';
+DROP TABLE t;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_dump_events_twice_bug.test b/mysql-test/suite/rpl/t/rpl_dump_events_twice_bug.test
new file mode 100644
index 00000000000..de82769010e
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_dump_events_twice_bug.test
@@ -0,0 +1,28 @@
+#
+# Verify dump thread can send events in active file, correctly after
+# encountering an IO error.
+#
+--source include/have_debug.inc
+--source include/master-slave.inc
+
+CALL mtr.add_suppression("Failed to read an event from active binlog.*");
+SET @debug_saved= @@GLOBAL.DEBUG;
+
+CREATE TABLE t1(c1 INT);
+INSERT INTO t1 VALUES(1);
+
+--sync_slave_with_master
+
+--source include/rpl_connection_master.inc
+SET GLOBAL debug='+d,dump_fake_io_error';
+INSERT INTO t1 VALUES(2);
+INSERT INTO t1 VALUES(3);
+
+--sync_slave_with_master
+--let $diff_tables= master:t1, slave:t1
+--source include/diff_tables.inc
+
+--source include/rpl_connection_master.inc
+SET @@GLOBAL.DEBUG= @debug_saved;
+DROP TABLE t1;
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_lost_events_on_rotate.test b/mysql-test/suite/rpl/t/rpl_lost_events_on_rotate.test
new file mode 100644
index 00000000000..08884ee8e26
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_lost_events_on_rotate.test
@@ -0,0 +1,51 @@
+#
+# Whenever the mysql_binlog_send method (dump thread) reaches the
+# end of file when reading events from the binlog, before checking
+# if it should wait for more events, there was a test to check if
+# the file being read was still active, i.e, it was the last known
+# binlog. However, it was possible that something was written to
+# the binary log and then a rotation would happen, after EOF was
+# detected and before the check for active was performed. In this
+# case, the end of the binary log would not be read by the dump
+# thread, and this would cause the slave to lose updates.
+#
+# This test verifies that the problem has been fixed. It waits
+# during this window while forcing a rotation in the binlog.
+#
+--source include/have_debug.inc
+--source include/master-slave.inc
+
+--connection master
+
+SET @debug_saved= @@GLOBAL.DEBUG;
+
+CREATE TABLE t (i INT);
+
+# When reaching the EOF the dump thread will wait before deciding if
+# it should move to a new binlong file.
+SET GLOBAL DEBUG= "d,wait_after_binlog_EOF";
+
+INSERT INTO t VALUES (1);
+
+--sleep 1
+
+# A insert and a rotate happens before the decision
+INSERT INTO t VALUES (2);
+FLUSH LOGS;
+
+SET DEBUG_SYNC= 'now SIGNAL signal.rotate_finished';
+
+--sync_slave_with_master
+
+# All the rows should be sent to the slave.
+--let $diff_tables=master:t,slave:t
+--source include/diff_tables.inc
+
+##Clean up
+--connection master
+
+SET @@GLOBAL.DEBUG= @debug_saved;
+SET DEBUG_SYNC= 'RESET';
+
+DROP TABLE t;
+--source include/rpl_end.inc