summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2006-02-18 17:19:16 +0100
committerunknown <guilhem@mysql.com>2006-02-18 17:19:16 +0100
commitcefc0b6dffcf3f7cd0e1ee7ebc6dd14eca622757 (patch)
tree6c8e6c047b411b83d6898b8886439ae27bac640c /mysql-test
parent187aab97b6936ed88b5021de0bc0ae342ac991c8 (diff)
downloadmariadb-git-cefc0b6dffcf3f7cd0e1ee7ebc6dd14eca622757.tar.gz
Fix for BUG#16559 "Replication Problems with Non transactional tables inside an interrupted trans.":
problem was: when a connection disconnects having an open transaction affecting MyISAM and InnoDB, the ROLLBACK event stored in the binary log contained a non-zero error code (1053 because of the disconnection), so when slave applied the transaction, slave complained that its ROLLBACK succeeded (error_code=0) while master's had 1053, so slave stopped. But internally generated binlog events such as this ROLLBACK should always have 0 as error code, as is true in 4.1 and was accidentally broken in 5.0, so that there is no false alarm. mysql-test/r/mix_innodb_myisam_binlog.result: result update mysql-test/t/mix_innodb_myisam_binlog.test: test for BUG#16559 sql/log.cc: Internally generated binlog events should always have an error code of zero (like in 4.1; in 5.0 this was accidentally broken).
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/mix_innodb_myisam_binlog.result23
-rw-r--r--mysql-test/t/mix_innodb_myisam_binlog.test33
2 files changed, 55 insertions, 1 deletions
diff --git a/mysql-test/r/mix_innodb_myisam_binlog.result b/mysql-test/r/mix_innodb_myisam_binlog.result
index c84bd65e748..2273b8c8756 100644
--- a/mysql-test/r/mix_innodb_myisam_binlog.result
+++ b/mysql-test/r/mix_innodb_myisam_binlog.result
@@ -256,3 +256,26 @@ master-bin.000001 1648 Query 1 # use `test`; create table t2 (n int) engine=inno
master-bin.000001 1748 Query 1 # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t1`,`test`.`ti`
do release_lock("lock1");
drop table t0,t2;
+reset master;
+create table t1 (a int) engine=innodb;
+create table t2 (a int) engine=myisam;
+select get_lock("a",10);
+get_lock("a",10)
+1
+begin;
+insert into t1 values(8);
+insert into t2 select * from t1;
+select get_lock("a",10);
+get_lock("a",10)
+1
+select
+(@a:=load_file("MYSQL_TEST_DIR/var/tmp/mix_innodb_myisam_binlog.output"))
+is not null;
+(@a:=load_file("MYSQL_TEST_DIR/var/tmp/mix_innodb_myisam_binlog.output"))
+is not null
+1
+select
+@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%",
+@a not like "%#%error_code=%error_code=%";
+@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%"
+1 1
diff --git a/mysql-test/t/mix_innodb_myisam_binlog.test b/mysql-test/t/mix_innodb_myisam_binlog.test
index 658584b625e..7ba7b634b22 100644
--- a/mysql-test/t/mix_innodb_myisam_binlog.test
+++ b/mysql-test/t/mix_innodb_myisam_binlog.test
@@ -259,5 +259,36 @@ show binlog events from 98;
do release_lock("lock1");
drop table t0,t2;
-
# End of 4.1 tests
+
+# Test for BUG#16559 (ROLLBACK should always have a zero error code in
+# binlog). Has to be here and not earlier, as the SELECTs influence
+# XIDs differently between normal and ps-protocol (and SHOW BINLOG
+# EVENTS above read XIDs).
+
+connect (con4,localhost,root,,);
+connection con3;
+reset master;
+create table t1 (a int) engine=innodb;
+create table t2 (a int) engine=myisam;
+select get_lock("a",10);
+begin;
+insert into t1 values(8);
+insert into t2 select * from t1;
+disconnect con3;
+
+connection con4;
+select get_lock("a",10); # wait for rollback to finish
+
+# we check that the error code of the "ROLLBACK" event is 0 and not
+# ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction
+# and does not make slave to stop)
+--exec $MYSQL_BINLOG --start-position=547 $MYSQL_TEST_DIR/var/log/master-bin.000001 > var/tmp/mix_innodb_myisam_binlog.output
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+eval select
+(@a:=load_file("$MYSQL_TEST_DIR/var/tmp/mix_innodb_myisam_binlog.output"))
+is not null;
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+eval select
+@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%",
+@a not like "%#%error_code=%error_code=%";