List:Commits« Previous MessageNext Message »
From:Sven Sandberg Date:March 15 2011 6:08pm
Subject:bzr commit into mysql-5.1 branch (sven.sandberg:3617) Bug#59539 Bug#11766427
View as plain text  
#At file:///home/sven/bzr/debug-max/5.1/ based on revid:dmitry.shulga@stripped

 3617 Sven Sandberg	2011-03-15
      BUG#11766427, BUG#59539: Filter by server id in mysqlbinlog fails
      Problem: mysqlbinlog --server-id may filter out Format_description_log_events.
      If mysqlbinlog does not process the Format_description_log_event,
      then mysqlbinlog cannot read the rest of the binary log correctly.
      This can have the effect that mysqlbinlog crashes, generates an error,
      or generates output that causes mysqld to crash, generate an error,
      or corrupt data.
      Fix: Never filter out Format_description_log_events.
     @ client/mysqlbinlog.cc
        Process Format_description_log_events even when the
        server_id does not match the number given by --server-id.
     @ mysql-test/t/mysqlbinlog.test
        Add test case.

    modified:
      client/mysqlbinlog.cc
      mysql-test/r/mysqlbinlog.result
      mysql-test/t/mysqlbinlog.test
=== modified file 'client/mysqlbinlog.cc'
--- a/client/mysqlbinlog.cc	2010-07-09 12:00:17 +0000
+++ b/client/mysqlbinlog.cc	2011-03-15 18:08:31 +0000
@@ -705,10 +705,10 @@ Exit_status process_event(PRINT_EVENT_IN
       */
       start_datetime= 0;
       offset= 0; // print everything and protect against cycling rec_count
+      if (server_id && (server_id != ev->server_id))
+        /* skip just this event, continue processing the log. */
+        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 03:52:57 +0000
+++ b/mysql-test/r/mysqlbinlog.result	2011-03-15 18:08:31 +0000
@@ -658,3 +658,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
 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 03:52:57 +0000
+++ b/mysql-test/t/mysqlbinlog.test	2011-03-15 18:08:31 +0000
@@ -501,3 +501,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;


Attachment: [text/bzr-bundle] bzr/sven.sandberg@oracle.com-20110315180831-o15a2yxyb1e0hj57.bundle
Thread
bzr commit into mysql-5.1 branch (sven.sandberg:3617) Bug#59539 Bug#11766427Sven Sandberg15 Mar
  • Re: bzr commit into mysql-5.1 branch (sven.sandberg:3617) Bug#59539Bug#11766427Luís Soares15 Mar
Re: bzr commit into mysql-5.1 branch (sven.sandberg:3617) Bug#59539Bug#11766427Sven Sandberg16 Mar