MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Sven Sandberg Date:March 25 2011 3:22pm
Subject:bzr push into mysql-trunk branch (sven.sandberg:3327 to 3328) Bug#59539
Bug#11766427
View as plain text  
 3328 Sven Sandberg	2011-03-25 [merge]
      Merged BUG#11766427, BUG#59539 from 5.5 to trunk.
      No conflicts.

    modified:
      client/mysqlbinlog.cc
      mysql-test/r/mysqlbinlog.result
      mysql-test/t/mysqlbinlog.test
 3327 Jon Olav Hauglid	2011-03-25
      Bug #11766752 (former 59936)
      Multiple XA assertions - transactional statement fuzzer
      
      The problem was that the server for several statements did not check
      the state of the current XA transaction (if any) before trying to
      execute the statement. Specifically, you are not supposed to do
      anything other than XA PREPARE / XA COMMIT ONE PHASE when in IDLE state,
      or anything other than XA COMMIT / XA ROLLBACK in PREPARED state.
      
      The assertions triggered by the testcase posted in the bug report,
      was triggered by trying to access a table or rollback to a savepoint
      when the current XA transaction was in PREPARED state.
      
      This patch fixes the problem by reporting ER_XAER_RMFAIL error if
      1) A statement is issued which requires a table to be opened
         when XA state is IDLE or PREPARED.
      2) SAVEPOINT or ROLLBACK TO SAVEPOINT is executed with an active
         XA transaction. (Similar to what is already done for COMMIT/ROLLBACK)
      
      These are incompatible changes and must be reflected in the
      documentation.
      
      Test case added to xa.test.
      Also verified with the C testcase posted on the bug report.

    modified:
      mysql-test/r/xa.result
      mysql-test/t/xa.test
      sql/sql_base.cc
      sql/transaction.cc
=== modified file 'client/mysqlbinlog.cc'
--- a/client/mysqlbinlog.cc	2011-01-18 12:09:03 +0000
+++ b/client/mysqlbinlog.cc	2011-03-25 15:20:25 +0000
@@ -683,10 +683,18 @@ Exit_status process_event(PRINT_EVENT_IN
       */
       start_datetime= 0;
       offset= 0; // print everything and protect against cycling rec_count
+      /*
+        Skip events according to the --server-id flag.  However, don't
+        skip format_description or rotate events, because they they
+        are really "global" events that are relevant for the entire
+        binlog, even if they have a server_id.  Also, we have to read
+        the format_description event so that we can parse subsequent
+        events.
+      */
+      if (ev_type != ROTATE_EVENT &&
+          server_id && (server_id != ev->server_id))
+        goto end;
     }
-    if (server_id && (server_id != ev->server_id))
-      /* skip just this event, continue processing the log. */
-      goto end;
     if (((my_time_t)(ev->when) >= stop_datetime)
         || (pos >= stop_position_mot))
     {

=== modified file 'mysql-test/r/mysqlbinlog.result'
--- a/mysql-test/r/mysqlbinlog.result	2010-12-29 05:35:31 +0000
+++ b/mysql-test/r/mysqlbinlog.result	2011-03-25 15:20:25 +0000
@@ -905,3 +905,15 @@ master-bin.000002	#	Query	#	#	CREATE DAT
 master-bin.000002	#	Query	#	#	use `test1`; CREATE TABLE t1(id int)
 master-bin.000002	#	Query	#	#	use `test1`; DROP TABLE `t1` /* generated by server */
 master-bin.000002	#	Query	#	#	DROP DATABASE test1
+RESET MASTER;
+USE test;
+CREATE TABLE t1 (a INT);
+SET GLOBAL SERVER_ID = 2;
+DROP TABLE t1;
+FLUSH LOGS;
+SHOW TABLES IN test;
+Tables_in_test
+t1
+SHOW TABLES IN test;
+Tables_in_test
+SET GLOBAL SERVER_ID = 1;

=== modified file 'mysql-test/t/mysqlbinlog.test'
--- a/mysql-test/t/mysqlbinlog.test	2010-12-29 05:35:31 +0000
+++ b/mysql-test/t/mysqlbinlog.test	2011-03-25 15:20:25 +0000
@@ -536,3 +536,23 @@ exec $MYSQL_BINLOG $MYSQLD_DATADIR/$mast
 let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
 source include/show_binlog_events.inc;
 
+#
+# BUG#11766427 BUG#59530: Filter by server id in mysqlbinlog fails
+# This test checks that the format description log event is not
+# filtered out by the --server-id option.
+#
+RESET MASTER;
+USE test;
+CREATE TABLE t1 (a INT);
+--let $old_server_id= `SELECT @@GLOBAL.SERVER_ID`
+SET GLOBAL SERVER_ID = 2;
+DROP TABLE t1;
+--let $master_binlog= query_get_value(SHOW MASTER STATUS, File, 1)
+FLUSH LOGS;
+# The following should only create t1, not drop it.
+--exec $MYSQL_BINLOG --server-id=1 $MYSQLD_DATADIR/$master_binlog | $MYSQL
+SHOW TABLES IN test;
+# The following should only drop t1, not create it.
+--exec $MYSQL_BINLOG --server-id=2 $MYSQLD_DATADIR/$master_binlog | $MYSQL
+SHOW TABLES IN test;
+eval SET GLOBAL SERVER_ID = $old_server_id;

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (sven.sandberg:3327 to 3328) Bug#59539Bug#11766427Sven Sandberg25 Mar