summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorguilhem@mysql.com <>2003-10-03 22:13:01 +0200
committerguilhem@mysql.com <>2003-10-03 22:13:01 +0200
commit52ae1609ebfd4bd8f0cec4f6c2e53b45889a7834 (patch)
tree09360947cec8862c4740eeb29ec0f1325a6084de /mysql-test
parent9f4d29c3f35796a8e6e195b8e081361388b6b9f4 (diff)
downloadmariadb-git-52ae1609ebfd4bd8f0cec4f6c2e53b45889a7834.tar.gz
When the I/O thread was stopped while copying a long transaction, and restarted,
Rotate_log_event::exec_event() believed that the relay log was corrupted. Fixed it by moving the test for corruption to Start_log_event::exec_event(). Changed Rotate_log_event::exec_event() to not increment positions when the event is seen in the middle of a transaction. I did a separate commit in 4.1 (so this should not be merged to 4.0) because code is a bit different in 4.1. A test to see if the slave detects when the master died while writing a transaction to the binlog (uses a forged truncated binlog I made).
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/rpl_trunc_binlog.result14
-rw-r--r--mysql-test/std_data/trunc_binlog.001bin0 -> 119 bytes
-rw-r--r--mysql-test/t/rpl_trunc_binlog.test22
3 files changed, 36 insertions, 0 deletions
diff --git a/mysql-test/r/rpl_trunc_binlog.result b/mysql-test/r/rpl_trunc_binlog.result
new file mode 100644
index 00000000000..6d2158eedfe
--- /dev/null
+++ b/mysql-test/r/rpl_trunc_binlog.result
@@ -0,0 +1,14 @@
+slave stop;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+slave start;
+stop slave;
+flush logs;
+reset slave;
+start slave;
+show slave status;
+Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
+127.0.0.1 root MASTER_PORT 1 master-bin.002 4 slave-relay-bin.002 161 master-bin.001 Yes No 0 there is an unfinished transaction in the relay log (could find neither COMMIT nor ROLLBACK in the relay log); it could be that the master died while writing the transaction to its binary log. Now the slave is rolling back the transaction. 0 79 317
+reset master;
diff --git a/mysql-test/std_data/trunc_binlog.001 b/mysql-test/std_data/trunc_binlog.001
new file mode 100644
index 00000000000..2c2b4ec6ce4
--- /dev/null
+++ b/mysql-test/std_data/trunc_binlog.001
Binary files differ
diff --git a/mysql-test/t/rpl_trunc_binlog.test b/mysql-test/t/rpl_trunc_binlog.test
new file mode 100644
index 00000000000..efdc3012471
--- /dev/null
+++ b/mysql-test/t/rpl_trunc_binlog.test
@@ -0,0 +1,22 @@
+# We are testing if a binlog which contains BEGIN but not COMMIT (the master did
+# while writing the transaction to the binlog) triggers an error on slave.
+# So we use such a truncated binlog and simulate that the master restarted after
+# this.
+
+source include/master-slave.inc;
+
+connection slave;
+stop slave;
+connection master;
+flush logs;
+system mv -f var/log/master-bin.001 var/log/master-bin.002;
+system cp std_data/trunc_binlog.001 var/log/master-bin.001;
+connection slave;
+reset slave;
+start slave;
+# can't sync_with_master so we must sleep
+sleep 3;
+--replace_result $MASTER_MYPORT MASTER_PORT
+show slave status;
+connection master;
+reset master;