List:Commits« Previous MessageNext Message »
From:Andrei Elkin Date:September 28 2010 3:43pm
Subject:bzr commit into mysql-next-mr branch (aelkin:3172) Bug#56006
View as plain text  
#At file:///home/andrei/MySQL/BZR/2a-23May/WL/mysql-next-mr-wl2540/ based on revid:aelkin@stripped

 3172 Andrei Elkin	2010-09-28 [merge]
      bug#56006
      
      merge -r > 3203 of 5.1-wl2540 to mext-mr-wl2540

    modified:
      libmysqld/Makefile.am
      mysql-test/suite/rpl/r/rpl_change_master.result
      mysql-test/suite/rpl/r/rpl_checksum.result
      mysql-test/suite/rpl/r/rpl_checksum_cache.result
      mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
      mysql-test/suite/rpl/t/rpl_change_master.test
      mysql-test/suite/rpl/t/rpl_checksum.test
      mysql-test/suite/rpl/t/rpl_checksum_cache.test
      mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
      sql/binlog.cc
      sql/log.cc
      sql/log_event.cc
      sql/rpl_utility.cc
=== modified file 'libmysqld/Makefile.am'
--- a/libmysqld/Makefile.am	2010-08-20 09:15:16 +0000
+++ b/libmysqld/Makefile.am	2010-09-28 15:42:48 +0000
@@ -58,7 +58,7 @@ sqlsources = derror.cc field.cc field_co
 	item_xmlfunc.cc \
 	sha2.cc des_key_file.cc \
 	key.cc lock.cc log.cc sql_state.c \
-	log_event.cc rpl_record.cc rpl_utility.cc \
+	log_event.cc rpl_record.cc rpl_utility.cc rpl_reporting.cc \
 	log_event_old.cc rpl_record_old.cc \
 	protocol.cc net_serv.cc opt_range.cc \
 	opt_sum.cc procedure.cc records.cc sql_acl.cc \

=== modified file 'mysql-test/suite/rpl/r/rpl_change_master.result'
--- a/mysql-test/suite/rpl/r/rpl_change_master.result	2010-07-29 01:51:38 +0000
+++ b/mysql-test/suite/rpl/r/rpl_change_master.result	2010-09-28 15:42:48 +0000
@@ -4,6 +4,7 @@ reset master;
 reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
+call mtr.add_suppression("Slave I/O: The slave I/O thread stops because a fatal error is encountered when it tried to SET @master_binlog_checksum");
 create table t1(n int);
 select * from t1;
 n

=== modified file 'mysql-test/suite/rpl/r/rpl_checksum.result'
--- a/mysql-test/suite/rpl/r/rpl_checksum.result	2010-09-28 14:49:24 +0000
+++ b/mysql-test/suite/rpl/r/rpl_checksum.result	2010-09-28 15:42:48 +0000
@@ -9,8 +9,8 @@ call mtr.add_suppression('Replication ev
 call mtr.add_suppression('Relay log write failure: could not queue event from master');
 set @master_save_binlog_checksum= @@global.binlog_checksum;
 set @save_master_verify_checksum =  @@global.master_verify_checksum;
-select @@global.binlog_checksum as 'must be one because of the command line option';
-must be one because of the command line option
+select @@global.binlog_checksum as 'must be CRC32 because of the command line option';
+must be CRC32 because of the command line option
 CRC32
 select @@session.binlog_checksum as 'no session var';
 ERROR HY000: Variable 'binlog_checksum' is a GLOBAL variable

=== modified file 'mysql-test/suite/rpl/r/rpl_checksum_cache.result'
--- a/mysql-test/suite/rpl/r/rpl_checksum_cache.result	2010-07-08 17:06:40 +0000
+++ b/mysql-test/suite/rpl/r/rpl_checksum_cache.result	2010-09-28 15:42:48 +0000
@@ -12,8 +12,12 @@ Warnings:
 Warning	1265	Data truncated for column 'pattern' at row 1
 set @save_binlog_cache_size = @@global.binlog_cache_size;
 set @save_binlog_checksum = @@global.binlog_checksum;
+set @save_master_verify_checksum = @@global.master_verify_checksum;
 set @@global.binlog_cache_size = 4096;
 set @@global.binlog_checksum = CRC32;
+set @@global.master_verify_checksum = 1;
+include/stop_slave.inc
+include/start_slave.inc
 flush status;
 show status like "binlog_cache_use";
 Variable_name	Value
@@ -33,7 +37,7 @@ set n= n-1;
 end while;
 end|
 begin;
-call test.p_init(4000, 32);
+call test.p_init(8000, 32);
 commit;
 show status like "binlog_cache_use";
 Variable_name	Value
@@ -117,6 +121,7 @@ commit;
 drop table t1, t2, t3;
 set @@global.binlog_cache_size = @save_binlog_cache_size;
 set @@global.binlog_checksum = @save_binlog_checksum;
+set @@global.master_verify_checksum = @save_master_verify_checksum;
 drop procedure test.p_init;
 drop procedure test.p1;
 End of tests

=== modified file 'mysql-test/suite/rpl/r/rpl_heartbeat_basic.result'
--- a/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result	2010-03-22 10:36:23 +0000
+++ b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result	2010-09-28 15:42:48 +0000
@@ -4,6 +4,7 @@ reset master;
 reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
+call mtr.add_suppression("Slave I/O: The slave I/O thread stops because a fatal error is encountered when it tried to SET @master_binlog_checksum");
 
 *** Preparing ***
 include/stop_slave.inc

=== modified file 'mysql-test/suite/rpl/t/rpl_change_master.test'
--- a/mysql-test/suite/rpl/t/rpl_change_master.test	2010-07-29 01:51:38 +0000
+++ b/mysql-test/suite/rpl/t/rpl_change_master.test	2010-09-28 15:42:48 +0000
@@ -4,6 +4,8 @@
 
 source include/master-slave.inc;
 
+call mtr.add_suppression("Slave I/O: The slave I/O thread stops because a fatal error is encountered when it tried to SET @master_binlog_checksum");
+
 connection master;
 # Make SQL slave thread advance a bit
 create table t1(n int);

=== modified file 'mysql-test/suite/rpl/t/rpl_checksum.test'
--- a/mysql-test/suite/rpl/t/rpl_checksum.test	2010-09-28 14:49:24 +0000
+++ b/mysql-test/suite/rpl/t/rpl_checksum.test	2010-09-28 15:42:48 +0000
@@ -18,7 +18,7 @@ connection master;
 set @master_save_binlog_checksum= @@global.binlog_checksum;
 set @save_master_verify_checksum =  @@global.master_verify_checksum;
 
-select @@global.binlog_checksum as 'must be one because of the command line option';
+select @@global.binlog_checksum as 'must be CRC32 because of the command line option';
 --error ER_INCORRECT_GLOBAL_LOCAL_VAR
 select @@session.binlog_checksum as 'no session var';
 
@@ -103,8 +103,7 @@ source include/wait_for_slave_io_to_stop
 
 let $errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
 let $error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1);
-let $error=`select substring("$error", 17)`;
-
+let $error= `select substring("$error", 17)`;  # todo:  declare a global const let $slave_error_date_col= 17
 --echo *** Got IO thread error code: $errno, text: $error ***
 
 select count(*) as zero from t1;
@@ -147,7 +146,7 @@ start slave io_thread;
 source include/wait_for_slave_io_to_stop.inc;
 let $errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
 let $error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1);
-let $error=`select substring("$error", 17)`;
+let $error= `select substring("$error", 17)`;
 --echo *** Got IO thread error code: $errno, text: $error ***
 set @@global.debug=''; # todo: merge
 
@@ -167,7 +166,7 @@ start slave sql_thread;
 source include/wait_for_slave_sql_to_stop.inc;
 let $errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
 let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
-let $error=`select substring("$error", 17)`;
+let $error= `select substring("$error", 17)`;
 --echo *** Got SQL thread error code: $errno, text: $error ***
 
 # resuming SQL thread to parse out the event w/o the failure

=== modified file 'mysql-test/suite/rpl/t/rpl_checksum_cache.test'
--- a/mysql-test/suite/rpl/t/rpl_checksum_cache.test	2010-07-08 17:06:40 +0000
+++ b/mysql-test/suite/rpl/t/rpl_checksum_cache.test	2010-09-28 15:42:48 +0000
@@ -4,11 +4,21 @@
 call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. Statement: insert into t2 set data=repeat.*'a', @act_size.*");
 call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. Statement: insert into t1 values.* NAME_CONST.*'n',.*, @data .*");
 
+
 connection master;
 set @save_binlog_cache_size = @@global.binlog_cache_size;
 set @save_binlog_checksum = @@global.binlog_checksum;
+set @save_master_verify_checksum = @@global.master_verify_checksum;
 set @@global.binlog_cache_size = 4096;
 set @@global.binlog_checksum = CRC32;
+set @@global.master_verify_checksum = 1;
+
+# restart slave to force the dump thread to verify events (on master side)
+connection slave;
+source include/stop_slave.inc;
+source include/start_slave.inc;
+
+connection master;
 
 #
 # Testing a critical part of checksum handling dealing with transaction cache.
@@ -57,7 +67,7 @@ end|
 
 delimiter ;|
 
-let $1 = 4000;
+let $1 = 8000;
 begin;
 --disable_warnings
 # todo: check if it is really so.
@@ -239,6 +249,7 @@ commit;
 drop table t1, t2, t3;
 set @@global.binlog_cache_size = @save_binlog_cache_size;
 set @@global.binlog_checksum = @save_binlog_checksum;
+set @@global.master_verify_checksum = @save_master_verify_checksum;
 drop procedure test.p_init;
 drop procedure test.p1;
 

=== modified file 'mysql-test/suite/rpl/t/rpl_heartbeat_basic.test'
--- a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test	2010-03-22 10:36:23 +0000
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test	2010-09-28 15:42:48 +0000
@@ -16,10 +16,14 @@
 # in order to not slow down much `make test'.
 #
 --source include/have_binlog_format_mixed.inc
+
+call mtr.add_suppression("Slave I/O: The slave I/O thread stops because a fatal error is encountered when it tried to SET @master_binlog_checksum");
+
 --echo
 
 --echo *** Preparing ***
 --connection slave
+
 --source include/stop_slave.inc
 RESET SLAVE;
 SET @restore_slave_net_timeout=@@global.slave_net_timeout;

=== modified file 'sql/binlog.cc'
--- a/sql/binlog.cc	2010-09-28 13:58:50 +0000
+++ b/sql/binlog.cc	2010-09-28 15:42:48 +0000
@@ -3313,6 +3313,7 @@ int MYSQL_BIN_LOG::write_cache(IO_CACHE 
   uchar header[LOG_EVENT_HEADER_LEN];
   ha_checksum crc, crc_0;
   my_bool do_checksum= (binlog_checksum_options != BINLOG_CHECKSUM_ALG_OFF);
+  uchar buf[BINLOG_CHECKSUM_LEN];
 
   // while there is just one alg the following must hold:
   DBUG_ASSERT(!do_checksum ||
@@ -3358,9 +3359,9 @@ int MYSQL_BIN_LOG::write_cache(IO_CACHE 
 
       if (do_checksum)
       {
+        ulong len= uint4korr(&header[EVENT_LEN_OFFSET]);
         /* fix len */
-        int4store(&header[EVENT_LEN_OFFSET], uint4korr(&header[EVENT_LEN_OFFSET])
-                  + BINLOG_CHECKSUM_LEN);
+        int4store(&header[EVENT_LEN_OFFSET], len + BINLOG_CHECKSUM_LEN);
       }
 
       /* write the first half of the split header */
@@ -3411,7 +3412,8 @@ int MYSQL_BIN_LOG::write_cache(IO_CACHE 
           return ER_ERROR_ON_WRITE;
         if (remains == 0)
         {
-          if (my_b_write(&log_file, &crc, BINLOG_CHECKSUM_LEN))
+          int4store(buf, crc);
+          if (my_b_write(&log_file, buf, BINLOG_CHECKSUM_LEN))
             return ER_ERROR_ON_WRITE;
           crc= crc_0;
         }
@@ -3434,10 +3436,11 @@ int MYSQL_BIN_LOG::write_cache(IO_CACHE 
             */
             DBUG_ASSERT(crc != crc_0);
             crc= my_checksum(crc, cache->read_pos, hdr_offs);
+            int4store(buf, crc);
             remains -= hdr_offs;
             DBUG_ASSERT(remains == 0);
             if (my_b_write(&log_file, cache->read_pos, hdr_offs) ||
-                my_b_write(&log_file, &crc, BINLOG_CHECKSUM_LEN))
+                my_b_write(&log_file, buf, BINLOG_CHECKSUM_LEN))
               return ER_ERROR_ON_WRITE;
             crc= crc_0;
           }
@@ -3473,7 +3476,8 @@ int MYSQL_BIN_LOG::write_cache(IO_CACHE 
               return ER_ERROR_ON_WRITE;
             if (remains == 0)
             {
-              if (my_b_write(&log_file, &crc, BINLOG_CHECKSUM_LEN))
+              int4store(buf, crc);
+              if (my_b_write(&log_file, buf, BINLOG_CHECKSUM_LEN))
                 return ER_ERROR_ON_WRITE;
               crc= crc_0; // crc is complete
             }

=== modified file 'sql/log.cc'
--- a/sql/log.cc	2010-09-28 15:06:04 +0000
+++ b/sql/log.cc	2010-09-28 15:42:48 +0000
@@ -1932,8 +1932,6 @@ bool general_log_write(THD *thd, enum en
   return FALSE;
 }
 
-
-
 /**
   Check if a string is a valid number.
 

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2010-09-28 15:06:04 +0000
+++ b/sql/log_event.cc	2010-09-28 15:42:48 +0000
@@ -652,57 +652,6 @@ static void print_set_option(IO_CACHE* f
   }
 }
 #endif
-
-/**
-   @param   even_buf    point to the buffer containing serialized event
-   @param   event_len   length of the event accounting possible checksum alg
-
-   @return  TRUE        if test fails
-            FALSE       as success
-*/
-inline bool event_checksum_test(uchar *event_buf, ulong event_len, uint8 alg)
-{
-  bool res= FALSE;
-  uint16 flags= 0; // to store in FD's buffer flags orig value
-
-  if (alg != BINLOG_CHECKSUM_ALG_OFF && alg != BINLOG_CHECKSUM_ALG_UNDEF)
-  {
-    ha_checksum incoming;
-    ha_checksum computed;
-
-    if (event_buf[EVENT_TYPE_OFFSET] == FORMAT_DESCRIPTION_EVENT)
-    {
-      /*
-        FD event is checksummed and therefore verified w/o the binlog-in-use flag
-      */
-      flags= uint2korr(event_buf + FLAGS_OFFSET);
-      if (flags & LOG_EVENT_BINLOG_IN_USE_F)
-        *((uint16*) event_buf + FLAGS_OFFSET) &= ~LOG_EVENT_BINLOG_IN_USE_F;
-      /* The only algorithm currently is CRC32 */
-      DBUG_ASSERT(event_buf[event_len - BINLOG_CHECKSUM_LEN - 
-                            BINLOG_CHECKSUM_ALG_DESC_LEN] ==
-                  BINLOG_CHECKSUM_ALG_CRC32);
-      DBUG_ASSERT(alg == BINLOG_CHECKSUM_ALG_CRC32);
-      /*
-        Complile time guard to watch over  the max number of alg
-      */
-      compile_time_assert(BINLOG_CHECKSUM_ALG_ENUM_END <= 0x80);
-    }
-    incoming= uint4korr(event_buf + event_len - BINLOG_CHECKSUM_LEN);
-    computed= my_checksum(0L, NULL, 0);
-    /* checksum the event content but the checksum part itself */
-    computed= my_checksum(computed, (const uchar*) event_buf, 
-                          event_len - BINLOG_CHECKSUM_LEN);
-    if (flags != 0)
-    {
-      /* restoring the orig value of flags of FD */
-      DBUG_ASSERT(event_buf[EVENT_TYPE_OFFSET] == FORMAT_DESCRIPTION_EVENT);
-      *((uint16*) event_buf + FLAGS_OFFSET)= flags;
-    }
-    res= !(computed == incoming);
-  }
-  return DBUG_EVALUATE_IF("simulate_checksum_test_failure", TRUE, res);
-}
 /**************************************************************************
 	Log_event methods (= the parent class of all events)
 **************************************************************************/

=== modified file 'sql/rpl_utility.cc'
--- a/sql/rpl_utility.cc	2010-07-16 21:00:50 +0000
+++ b/sql/rpl_utility.cc	2010-09-28 15:42:48 +0000
@@ -1056,3 +1056,58 @@ table_def::~table_def()
 #endif
 }
 
+/**
+   @param   even_buf    point to the buffer containing serialized event
+   @param   event_len   length of the event accounting possible checksum alg
+
+   @return  TRUE        if test fails
+            FALSE       as success
+*/
+bool event_checksum_test(uchar *event_buf, ulong event_len, uint8 alg)
+{
+  bool res= FALSE;
+  uint16 flags= 0; // to store in FD's buffer flags orig value
+
+  if (alg != BINLOG_CHECKSUM_ALG_OFF && alg != BINLOG_CHECKSUM_ALG_UNDEF)
+  {
+    ha_checksum incoming;
+    ha_checksum computed;
+
+    if (event_buf[EVENT_TYPE_OFFSET] == FORMAT_DESCRIPTION_EVENT)
+    {
+#ifndef DBUG_OFF
+      int8 fd_alg= event_buf[event_len - BINLOG_CHECKSUM_LEN - 
+                             BINLOG_CHECKSUM_ALG_DESC_LEN];
+#endif
+      /*
+        FD event is checksummed and therefore verified w/o the binlog-in-use flag
+      */
+      flags= uint2korr(event_buf + FLAGS_OFFSET);
+      if (flags & LOG_EVENT_BINLOG_IN_USE_F)
+        event_buf[FLAGS_OFFSET] &= ~LOG_EVENT_BINLOG_IN_USE_F;
+      /* 
+         The only algorithm currently is CRC32. Zero indicates 
+         the binlog file is checksum-free *except* the FD-event.
+      */
+      DBUG_ASSERT(fd_alg == BINLOG_CHECKSUM_ALG_CRC32 || fd_alg == 0);
+      DBUG_ASSERT(alg == BINLOG_CHECKSUM_ALG_CRC32);
+      /*
+        Complile time guard to watch over  the max number of alg
+      */
+      compile_time_assert(BINLOG_CHECKSUM_ALG_ENUM_END <= 0x80);
+    }
+    incoming= uint4korr(event_buf + event_len - BINLOG_CHECKSUM_LEN);
+    computed= my_checksum(0L, NULL, 0);
+    /* checksum the event content but the checksum part itself */
+    computed= my_checksum(computed, (const uchar*) event_buf, 
+                          event_len - BINLOG_CHECKSUM_LEN);
+    if (flags != 0)
+    {
+      /* restoring the orig value of flags of FD */
+      DBUG_ASSERT(event_buf[EVENT_TYPE_OFFSET] == FORMAT_DESCRIPTION_EVENT);
+      event_buf[FLAGS_OFFSET]= flags;
+    }
+    res= !(computed == incoming);
+  }
+  return DBUG_EVALUATE_IF("simulate_checksum_test_failure", TRUE, res);
+}


Attachment: [text/bzr-bundle] bzr/aelkin@mysql.com-20100928154248-q8dddk92jgcvo20j.bundle
Thread
bzr commit into mysql-next-mr branch (aelkin:3172) Bug#56006Andrei Elkin28 Sep