List:Commits« Previous MessageNext Message »
From:Andrei Elkin Date:August 31 2010 5:06pm
Subject:bzr push into mysql-5.1-rep+2 branch (aelkin:3208 to 3209)
View as plain text  
 3209 Andrei Elkin	2010-08-31
      bug56006
      
      fixing 
      
      - building on solaris;
      - failure on solaris (endiness);
      - suppression due to crc handshake is added to two tests;
     @ libmysqld/Makefile.am
        rpl_utility.cc calls a function defined in  rpl_reporting.cc.
        Adding the latter file to contribute to libmysqld with that func in particular.
        For a reason undetected building in examples/ with -l libmysqld.a
        did not reveal that issue until a new `event_checksum_test' function
        body has been relocated from log_event.cc.
     @ mysql-test/suite/rpl/r/rpl_change_master.result
        results changed.
     @ mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
        results changed.
     @ mysql-test/suite/rpl/t/rpl_change_master.test
        a new suppression because checksum code conducts master-slave network handshake interruptable
        and detectable by mtr.
     @ mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
        a new suppression because checksum code conducts master-slave network handshake interruptable
        and detectable by mtr.
     @ sql/log.cc
        endianess issue was reveal by running on solaris platfrom.
        CRC value has to be int4stored.
     @ sql/log_event.cc
        moving event_checksum_test() into a proper holder-file to satisfy a set of linker constraints,
        including:
        1. resolving linker time dependencies on solaris where log_event.o symbols could not be 
           found by slave.o, because the latter follows the former in the list of object files;
        2. mysqlbinlog needs the func
        3. examples/libmysqld executable needs the function
        
        The new location is chosen to be rpl_utility.cc which safices the three requirements.
     @ sql/rpl_utility.cc
        event_checksum_test() is added to the file to satify linker constraints.

    modified:
      libmysqld/Makefile.am
      mysql-test/suite/rpl/r/rpl_change_master.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_heartbeat_basic.test
      sql/log.cc
      sql/log_event.cc
      sql/rpl_utility.cc
 3208 Andrei Elkin	2010-08-29
      Bug #56006
      
      there were failure with rpl_checksum_cache in MBL::write_cache() caused by
      an opeque issue with int4store expansion on 64 bit platforms (linux in particular).
      
      The core reason of int4store issue is yet unknown (a bug to be reported). However, there is a simple workaround to not invoke the macro inside another macro which is implemented to satisfy the test

    modified:
      sql/log.cc
=== modified file 'libmysqld/Makefile.am'
--- a/libmysqld/Makefile.am	2009-12-15 20:21:00 +0000
+++ b/libmysqld/Makefile.am	2010-08-31 17:05:58 +0000
@@ -55,7 +55,7 @@ sqlsources = derror.cc field.cc field_co
 	item_geofunc.cc item_subselect.cc item_row.cc\
 	item_xmlfunc.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-06-29 03:23:02 +0000
+++ b/mysql-test/suite/rpl/r/rpl_change_master.result	2010-08-31 17:05:58 +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_heartbeat_basic.result'
--- a/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result	2010-08-27 15:36:07 +0000
+++ b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result	2010-08-31 17:05:58 +0000
@@ -4,9 +4,9 @@ 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 ***
-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");
 include/stop_slave.inc
 RESET SLAVE;
 SET @restore_slave_net_timeout=@@global.slave_net_timeout;

=== modified file 'mysql-test/suite/rpl/t/rpl_change_master.test'
--- a/mysql-test/suite/rpl/t/rpl_change_master.test	2010-06-24 08:53:57 +0000
+++ b/mysql-test/suite/rpl/t/rpl_change_master.test	2010-08-31 17:05:58 +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_heartbeat_basic.test'
--- a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test	2010-08-27 10:43:27 +0000
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test	2010-08-31 17:05:58 +0000
@@ -10,13 +10,14 @@
 # * Circular replication
 #############################################################
 --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");
+
 --echo
 
 --echo *** Preparing ***
 --connection 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");
-
 --source include/stop_slave.inc
 RESET SLAVE;
 SET @restore_slave_net_timeout=@@global.slave_net_timeout;

=== modified file 'sql/log.cc'
--- a/sql/log.cc	2010-08-29 15:37:18 +0000
+++ b/sql/log.cc	2010-08-31 17:05:58 +0000
@@ -4976,6 +4976,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 ||
@@ -5074,7 +5075,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;
         }
@@ -5097,10 +5099,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;
           }
@@ -5136,7 +5139,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_event.cc'
--- a/sql/log_event.cc	2010-08-25 07:41:30 +0000
+++ b/sql/log_event.cc	2010-08-31 17:05:58 +0000
@@ -638,60 +638,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)
-    {
-      IF_DBUG(int8 fd_alg= event_buf[event_len - BINLOG_CHECKSUM_LEN - 
-                                     BINLOG_CHECKSUM_ALG_DESC_LEN];);
-      /*
-        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);
-}
 /**************************************************************************
 	Log_event methods (= the parent class of all events)
 **************************************************************************/

=== modified file 'sql/rpl_utility.cc'
--- a/sql/rpl_utility.cc	2010-06-16 14:15:39 +0000
+++ b/sql/rpl_utility.cc	2010-08-31 17:05:58 +0000
@@ -1051,3 +1051,59 @@ table_def::~table_def()
   m_size= 0;
 #endif
 }
+
+#if 1 // !defined(EMBEDDED_LIBRARY)
+/**
+   @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)
+    {
+      IF_DBUG(int8 fd_alg= event_buf[event_len - BINLOG_CHECKSUM_LEN - 
+                                     BINLOG_CHECKSUM_ALG_DESC_LEN];);
+      /*
+        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);
+}
+#endif


Attachment: [text/bzr-bundle] bzr/aelkin@mysql.com-20100831170558-nghztewfsukudlr7.bundle
Thread
bzr push into mysql-5.1-rep+2 branch (aelkin:3208 to 3209)Andrei Elkin31 Aug