List:Commits« Previous MessageNext Message »
From:Martin Skold Date:October 22 2010 12:08pm
Subject:bzr commit into mysql-5.1-telco-7.1 branch (Martin.Skold:3915) Bug#52131
View as plain text  
#At file:///home/marty/MySQL/mysql-5.1-telco-7.1/

 3915 Martin Skold	2010-10-22 [merge]
      Merge
      modified:
        mysql-test/collections/default.experimental
        sql/field.cc
        sql/field.h
        sql/rpl_record.cc

=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental	2010-10-12 14:53:28 +0000
+++ b/mysql-test/collections/default.experimental	2010-10-22 11:53:16 +0000
@@ -3,8 +3,6 @@
 
 
 binlog.binlog_unsafe @solaris            # Bug #47128 Test "binlog_unsafe" exceds default stack allocation
-rpl_ndb.rpl_ndb_typeconv_all @solaris    # bug#52131
-rpl_ndb.rpl_ndb_typeconv_lossy @solaris  # bug#52131
 
 funcs_1.charset_collation_1              # depends on compile-time decisions
 
@@ -23,5 +21,3 @@ rpl_ndb.rpl_ndb_2ndb   # rpl_ndb_2ndb fa
 
 binlog.binlog_unsafe @solaris            # Bug #47128 Test "binlog_unsafe" exceds default stack allocation
 
-rpl_ndb.rpl_ndb_typeconv_all @solaris    # bug#52131
-rpl_ndb.rpl_ndb_typeconv_lossy @solaris  # bug#52131

=== modified file 'sql/field.cc'
--- a/sql/field.cc	2010-10-20 14:06:09 +0000
+++ b/sql/field.cc	2010-10-22 08:13:00 +0000
@@ -8092,12 +8092,6 @@ void Field_blob::sql_type(String &res) c
 uchar *Field_blob::pack(uchar *to, const uchar *from,
                         uint max_length, bool low_byte_first)
 {
-  DBUG_ENTER("Field_blob::pack");
-  DBUG_PRINT("enter", ("to: 0x%lx; from: 0x%lx;"
-                       " max_length: %u; low_byte_first: %d",
-                       (ulong) to, (ulong) from,
-                       max_length, low_byte_first));
-  DBUG_DUMP("record", from, table->s->reclength);
   uchar *save= ptr;
   ptr= (uchar*) from;
   uint32 length=get_length();			// Length of from string
@@ -8118,8 +8112,7 @@ uchar *Field_blob::pack(uchar *to, const
     memcpy(to+packlength, from,length);
   }
   ptr=save;					// Restore org row pointer
-  DBUG_DUMP("packed", to, packlength + length);
-  DBUG_RETURN(to+packlength+length);
+  return to+packlength+length;
 }
 
 
@@ -8896,6 +8889,69 @@ uint Field_enum::is_equal(Create_field *
 }
 
 
+uchar *Field_enum::pack(uchar *to, const uchar *from,
+                        uint max_length, bool low_byte_first)
+{
+  DBUG_ENTER("Field_enum::pack");
+  DBUG_PRINT("debug", ("packlength: %d", packlength));
+  DBUG_DUMP("from", from, packlength);
+  uchar *result= to + 1;
+
+  switch (packlength)
+  {
+  case 1:
+    *to = *from;
+    break;
+  case 2:
+    result= pack_int16(to, from, low_byte_first);
+    break;
+  case 3:
+    result= pack_int24(to, from, low_byte_first);
+    break;
+  case 4:
+    result= pack_int32(to, from, low_byte_first);
+    break;
+  case 8:
+    result= pack_int64(to, from, low_byte_first);
+    break;
+  default:
+    DBUG_ASSERT(0);
+  }
+  DBUG_RETURN(result);
+}
+
+const uchar *Field_enum::unpack(uchar *to, const uchar *from,
+                                uint param_data, bool low_byte_first)
+{
+  DBUG_ENTER("Field_enum::unpack");
+  DBUG_PRINT("debug", ("packlength: %d", packlength));
+  DBUG_DUMP("from", from, packlength);
+  const uchar *result= from + 1;
+
+  switch (packlength)
+  {
+  case 1:
+    *to = *from;
+    break;
+  case 2:
+    result= unpack_int16(to, from, low_byte_first);
+    break;
+  case 3:
+    result= unpack_int24(to, from, low_byte_first);
+    break;
+  case 4:
+    result= unpack_int32(to, from, low_byte_first);
+    break;
+  case 8:
+    result= unpack_int64(to, from, low_byte_first);
+    break;
+  default:
+    DBUG_ASSERT(0);
+  }
+  DBUG_RETURN(result);
+}
+
+
 /**
   @return
   returns 1 if the fields are equally defined

=== modified file 'sql/field.h'
--- a/sql/field.h	2010-10-20 14:06:09 +0000
+++ b/sql/field.h	2010-10-21 14:35:49 +0000
@@ -554,6 +554,48 @@ private:
   { return 0; }
 
 protected:
+  static void handle_int16(uchar *to, const uchar *from,
+                           bool low_byte_first_from, bool low_byte_first_to)
+  {
+    int16 val;
+#ifdef WORDS_BIGENDIAN
+    if (low_byte_first_from)
+      val = sint2korr(from);
+    else
+#endif
+      shortget(val, from);
+
+#ifdef WORDS_BIGENDIAN
+    if (low_byte_first_to)
+      int2store(to, val);
+    else
+#endif
+      shortstore(to, val);
+  }
+
+  static void handle_int24(uchar *to, const uchar *from,
+                           bool low_byte_first_from, bool low_byte_first_to)
+  {
+    int32 val;
+#ifdef WORDS_BIGENDIAN
+    if (low_byte_first_from)
+      val = sint3korr(from);
+    else
+#endif
+      val= (from[0] << 16) + (from[1] << 8) + from[2];
+
+#ifdef WORDS_BIGENDIAN
+    if (low_byte_first_to)
+      int2store(to, val);
+    else
+#endif
+    {
+      to[0]= 0xFF & (val >> 16);
+      to[1]= 0xFF & (val >> 8);
+      to[2]= 0xFF & val;
+    }
+  }
+
   /*
     Helper function to pack()/unpack() int32 values
   */
@@ -598,6 +640,32 @@ protected:
       longlongstore(to, val);
   }
 
+  uchar *pack_int16(uchar *to, const uchar *from, bool low_byte_first_to)
+  {
+    handle_int16(to, from, table->s->db_low_byte_first, low_byte_first_to);
+    return to  + sizeof(int16);
+  }
+
+  const uchar *unpack_int16(uchar* to, const uchar *from,
+                            bool low_byte_first_from)
+  {
+    handle_int16(to, from, low_byte_first_from, table->s->db_low_byte_first);
+    return from + sizeof(int16);
+  }
+
+  uchar *pack_int24(uchar *to, const uchar *from, bool low_byte_first_to)
+  {
+    handle_int24(to, from, table->s->db_low_byte_first, low_byte_first_to);
+    return to + 3;
+  }
+
+  const uchar *unpack_int24(uchar* to, const uchar *from,
+                            bool low_byte_first_from)
+  {
+    handle_int24(to, from, low_byte_first_from, table->s->db_low_byte_first);
+    return from + 3;
+  }
+
   uchar *pack_int32(uchar *to, const uchar *from, bool low_byte_first_to)
   {
     handle_int32(to, from, table->s->db_low_byte_first, low_byte_first_to);
@@ -911,41 +979,13 @@ public:
   virtual uchar *pack(uchar* to, const uchar *from,
                       uint max_length, bool low_byte_first)
   {
-    int16 val;
-#ifdef WORDS_BIGENDIAN
-    if (table->s->db_low_byte_first)
-      val = sint2korr(from);
-    else
-#endif
-      shortget(val, from);
-
-#ifdef WORDS_BIGENDIAN
-    if (low_byte_first)
-      int2store(to, val);
-    else
-#endif
-      shortstore(to, val);
-    return to + sizeof(val);
+    return pack_int16(to, from, low_byte_first);
   }
 
   virtual const uchar *unpack(uchar* to, const uchar *from,
                               uint param_data, bool low_byte_first)
   {
-    int16 val;
-#ifdef WORDS_BIGENDIAN
-    if (low_byte_first)
-      val = sint2korr(from);
-    else
-#endif
-      shortget(val, from);
-
-#ifdef WORDS_BIGENDIAN
-    if (table->s->db_low_byte_first)
-      int2store(to, val);
-    else
-#endif
-      shortstore(to, val);
-    return from + sizeof(val);
+    return unpack_int16(to, from, low_byte_first);
   }
 };
 
@@ -1888,6 +1928,12 @@ public:
   bool has_charset(void) const { return TRUE; }
   /* enum and set are sorted as integers */
   CHARSET_INFO *sort_charset(void) const { return &my_charset_bin; }
+
+  virtual uchar *pack(uchar *to, const uchar *from,
+                      uint max_length, bool low_byte_first);
+  virtual const uchar *unpack(uchar *to, const uchar *from,
+                              uint param_data, bool low_byte_first);
+
 private:
   int do_save_field_metadata(uchar *first_byte);
   uint is_equal(Create_field *new_field);

=== modified file 'sql/rpl_record.cc'
--- a/sql/rpl_record.cc	2010-03-12 10:36:52 +0000
+++ b/sql/rpl_record.cc	2010-10-21 11:46:57 +0000
@@ -80,8 +80,6 @@ pack_row(TABLE *table, MY_BITMAP const* 
   unsigned int null_mask= 1U;
   for ( ; (field= *p_field) ; p_field++)
   {
-    DBUG_PRINT("debug", ("null_mask=%d; null_ptr=%p; row_data=%p; null_byte_count=%d",
-                         null_mask, null_ptr, row_data, null_byte_count));
     if (bitmap_is_set(cols, p_field - table->field))
     {
       my_ptrdiff_t offset;
@@ -112,6 +110,7 @@ pack_row(TABLE *table, MY_BITMAP const* 
                              field->field_name, field->real_type(),
                              (ulong) old_pack_ptr, (ulong) pack_ptr,
                              (int) (pack_ptr - old_pack_ptr)));
+        DBUG_DUMP("packed_data", old_pack_ptr, pack_ptr - old_pack_ptr);
       }
 
       null_mask <<= 1;
@@ -381,8 +380,11 @@ unpack_row(Relay_log_info const *rli,
       }
       DBUG_ASSERT(null_mask & 0xFF); // One of the 8 LSB should be set
 
-      if (!((null_bits & null_mask) && tabledef->maybe_null(i)))
-        pack_ptr+= tabledef->calc_field_size(i, (uchar *) pack_ptr);
+      if (!((null_bits & null_mask) && tabledef->maybe_null(i))) {
+        uint32 len= tabledef->calc_field_size(i, (uchar *) pack_ptr);
+        DBUG_DUMP("field_data", pack_ptr, len);
+        pack_ptr+= len;
+      }
       null_mask <<= 1;
     }
   }

Thread
bzr commit into mysql-5.1-telco-7.1 branch (Martin.Skold:3915) Bug#52131Martin Skold22 Oct