List:Commits« Previous MessageNext Message »
From:guilhem Date:February 18 2006 5:19pm
Subject:bk commit into 5.0 tree (guilhem:1.2061) BUG#16559
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of guilhem. When guilhem does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2061 06/02/18 17:19:16 guilhem@stripped +3 -0
  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.

  sql/log.cc
    1.187 06/02/18 17:19:10 guilhem@stripped +5 -1
    Internally generated binlog events should always have an error code of zero (like in
4.1; in 5.0 this was accidentally broken).

  mysql-test/t/mix_innodb_myisam_binlog.test
    1.21 06/02/18 17:19:10 guilhem@stripped +32 -1
    test for BUG#16559

  mysql-test/r/mix_innodb_myisam_binlog.result
    1.25 06/02/18 17:19:10 guilhem@stripped +23 -0
    result update

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	guilhem
# Host:	gbichot3.local
# Root:	/home/mysql_src/mysql-5.0

--- 1.186/sql/log.cc	2005-11-22 01:02:33 +01:00
+++ 1.187/sql/log.cc	2006-02-18 17:19:10 +01:00
@@ -132,6 +132,7 @@
     DBUG_RETURN(0);
   }
   Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, FALSE);
+  qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE)
   DBUG_RETURN(binlog_end_trans(thd, trans_log, &qev));
 }
 
@@ -156,6 +157,7 @@
   if (unlikely(thd->options & OPTION_STATUS_NO_TRANS_UPDATE))
   {
     Query_log_event qev(thd, STRING_WITH_LEN("ROLLBACK"), TRUE, FALSE);
+    qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE)
     error= binlog_end_trans(thd, trans_log, &qev);
   }
   else
@@ -1826,7 +1828,9 @@
         Imagine this is rollback due to net timeout, after all statements of
         the transaction succeeded. Then we want a zero-error code in BEGIN.
         In other words, if there was a really serious error code it's already
-        in the statement's events.
+        in the statement's events, there is no need to put it also in this
+        internally generated event, and as this event is generated late it
+        would lead to false alarms.
         This is safer than thd->clear_error() against kills at shutdown.
       */
       qinfo.error_code= 0;

--- 1.24/mysql-test/r/mix_innodb_myisam_binlog.result	2005-11-18 05:17:45 +01:00
+++ 1.25/mysql-test/r/mix_innodb_myisam_binlog.result	2006-02-18 17:19:10 +01:00
@@ -256,3 +256,26 @@
 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

--- 1.20/mysql-test/t/mix_innodb_myisam_binlog.test	2005-11-18 05:17:45 +01:00
+++ 1.21/mysql-test/t/mix_innodb_myisam_binlog.test	2006-02-18 17:19:10 +01:00
@@ -259,5 +259,36 @@
 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=%";
Thread
bk commit into 5.0 tree (guilhem:1.2061) BUG#16559guilhem18 Feb