List:Commits« Previous MessageNext Message »
From:Andrei Elkin Date:February 20 2009 11:55am
Subject:bzr commit into mysql-5.0-bugteam branch (aelkin:2757) Bug#37313
View as plain text  
#At file:///home/andrei/MySQL/BZR/FIXES/bug37313-server_id_binlog/ based on revid:joro@stripped

 2757 Andrei Elkin	2009-02-20
      Bug #37313 BINLOG Contains Incorrect server id
        
      Signed integer format specifier forced to print the binlog header with server_id
      negative if the unsigned value sets the sign-bit ON.
        
      Fixed with correcting the specifier to correspond to typeof(server_id) == ulong.
modified:
  mysql-test/r/mysqlbinlog.result
  mysql-test/t/mysqlbinlog.test
  sql/log_event.cc

per-file messages:
  mysql-test/r/mysqlbinlog.result
    results changed.
  mysql-test/t/mysqlbinlog.test
    displaying the expected unsignedly formatted server_id value, bug#37313.
  sql/log_event.cc
    Format specifier is corrected to correspond to typeof(server_id).
=== modified file 'mysql-test/r/mysqlbinlog.result'
--- a/mysql-test/r/mysqlbinlog.result	2008-05-15 23:13:24 +0000
+++ b/mysql-test/r/mysqlbinlog.result	2009-02-20 11:55:43 +0000
@@ -362,4 +362,14 @@ drop table t1;
 1
 drop table t1;
 shell> mysqlbinlog std_data/corrupt-relay-bin.000624 > var/tmp/bug31793.sql
+set @@global.server_id= 4294967295;
+reset master;
+select
+(@a:=load_file("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
+is not null;
+(@a:=load_file("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
+is not null
+1
+*** Unsigned server_id 4294967295 is found: 1 ***
+set @@global.server_id= 1;
 End of 5.0 tests

=== modified file 'mysql-test/t/mysqlbinlog.test'
--- a/mysql-test/t/mysqlbinlog.test	2008-02-01 16:26:28 +0000
+++ b/mysql-test/t/mysqlbinlog.test	2009-02-20 11:55:43 +0000
@@ -253,4 +253,24 @@ echo shell> mysqlbinlog std_data/corrupt
 error 1;
 exec $MYSQL_BINLOG $MYSQL_TEST_DIR/std_data/corrupt-relay-bin.000624 > $MYSQLTEST_VARDIR/tmp/bug31793.sql;
 
+#
+# Bug #37313  	BINLOG Contains Incorrect server id
+#
+
+let $save_server_id= `select @@global.server_id`;
+let $s_id_max=`select (1 << 32) - 1`;
+eval set @@global.server_id= $s_id_max;
+
+reset master;
+--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval select
+(@a:=load_file("$MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
+is not null;
+let $s_id_unsigned= `select @a like "%server id $s_id_max%" /* must return 1 */`;
+echo *** Unsigned server_id $s_id_max is found: $s_id_unsigned ***;
+
+eval set @@global.server_id= $save_server_id;
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog
+
 --echo End of 5.0 tests

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2008-07-07 07:58:27 +0000
+++ b/sql/log_event.cc	2009-02-20 11:55:43 +0000
@@ -976,7 +976,7 @@ void Log_event::print_header(FILE* file,
 
   fputc('#', file);
   print_timestamp(file);
-  fprintf(file, " server id %d  end_log_pos %s ", server_id,
+  fprintf(file, " server id %lu  end_log_pos %s ", server_id,
 	  llstr(log_pos,llbuff));
 
   /* mysqlbinlog --hexdump */

Thread
bzr commit into mysql-5.0-bugteam branch (aelkin:2757) Bug#37313Andrei Elkin20 Feb