MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Luis Soares Date:March 11 2010 11:07am
Subject:bzr commit into mysql-6.0-codebase-bugfixing branch (luis.soares:3814)
Bug#51716 Bug#51787
View as plain text  
#At file:///home/lsoares/Workspace/bzr/work/bugfixing/51787/mysql-6.0-codebase-bugfixing-push/ based on revid:jorgen.loland@stripped

 3814 Luis Soares	2010-03-11 [merge]
      Fix for BUG#51716 and BUG#51787: merge to 6.0-codebase-bugfixing.
      
      Manually merged tests changes:
      
        - rpl_row_utf16
          Removed the empty INSERT! Because of BUG@49100, the test would
          fail.
      
        - rpl_row_utf32
          Removed the warnings from the result file. Maximum key size is
          1332 bytes in 6.0, thence we don't get warnings.

    added:
      mysql-test/suite/rpl/r/rpl_row_utf16.result
      mysql-test/suite/rpl/r/rpl_row_utf32.result
      mysql-test/suite/rpl/t/rpl_row_utf16.test
      mysql-test/suite/rpl/t/rpl_row_utf32.test
    modified:
      sql/field.cc
      sql/rpl_utility.cc
=== added file 'mysql-test/suite/rpl/r/rpl_row_utf16.result'
--- a/mysql-test/suite/rpl/r/rpl_row_utf16.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_utf16.result	2010-03-11 11:06:31 +0000
@@ -0,0 +1,18 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1(c1 CHAR(10) CHARACTER SET utf16 DEFAULT 'ola');
+INSERT INTO t1 VALUES ('abc');
+#### ON MASTER
+SELECT c1, hex(c1) from t1;
+c1	abc
+hex(c1)	006100620063
+#### ON SLAVE
+SELECT c1, hex(c1) FROM t1;
+c1	abc
+hex(c1)	006100620063
+Comparing tables master:test.t1 and slave:test.t1
+DROP TABLE t1;

=== added file 'mysql-test/suite/rpl/r/rpl_row_utf32.result'
--- a/mysql-test/suite/rpl/r/rpl_row_utf32.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_utf32.result	2010-03-11 11:06:31 +0000
@@ -0,0 +1,21 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+SET SQL_LOG_BIN=0;
+CREATE TABLE t1 (c1 char(255) DEFAULT NULL, KEY c1 (c1)) DEFAULT CHARSET=utf32;
+SET SQL_LOG_BIN=1;
+SET @saved_slave_type_conversions= @@global.slave_type_conversions;
+include/stop_slave.inc
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
+include/start_slave.inc
+SET SQL_LOG_BIN=0;
+CREATE TABLE t1 ( c1 varchar(255) DEFAULT NULL, KEY c1 (c1)) DEFAULT CHARSET=utf32;
+SET SQL_LOG_BIN=1;
+INSERT INTO t1(c1) VALUES ('insert into t1');
+DROP TABLE t1;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS= @saved_slave_type_conversions;
+include/stop_slave.inc
+include/start_slave.inc

=== added file 'mysql-test/suite/rpl/t/rpl_row_utf16.test'
--- a/mysql-test/suite/rpl/t/rpl_row_utf16.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_utf16.test	2010-03-11 11:06:31 +0000
@@ -0,0 +1,25 @@
+-- source include/master-slave.inc
+-- source include/have_binlog_format_row.inc
+-- source include/have_utf16.inc
+
+#
+# BUG#51716: Char column with utf16 character set gives wrong padding on slave
+#
+
+CREATE TABLE t1(c1 CHAR(10) CHARACTER SET utf16 DEFAULT 'ola');
+INSERT INTO t1 VALUES ('abc');  # explicit value is inserted and encoded correctly
+
+-- echo #### ON MASTER
+--query_vertical SELECT c1, hex(c1) from t1
+
+-- sync_slave_with_master
+
+-- echo #### ON SLAVE
+--query_vertical SELECT c1, hex(c1) FROM t1
+
+# assertion: tables don't differ
+-- let $diff_table_1=master:test.t1
+-- let $diff_table_2=slave:test.t1
+-- source include/diff_tables.inc
+
+DROP TABLE t1;

=== added file 'mysql-test/suite/rpl/t/rpl_row_utf32.test'
--- a/mysql-test/suite/rpl/t/rpl_row_utf32.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_utf32.test	2010-03-10 22:20:39 +0000
@@ -0,0 +1,44 @@
+-- source include/master-slave.inc
+-- source include/have_binlog_format_row.inc
+-- source include/have_utf32.inc
+
+#
+# BUG#51787 Assertion `(n % 4) == 0' on slave upon INSERT into a table with UTF32
+#
+
+SET SQL_LOG_BIN=0;
+CREATE TABLE t1 (c1 char(255) DEFAULT NULL, KEY c1 (c1)) DEFAULT CHARSET=utf32;
+SET SQL_LOG_BIN=1;
+
+-- connection slave
+
+SET @saved_slave_type_conversions= @@global.slave_type_conversions;
+
+#
+#  Force test to cover conversion execution path in the
+#  slave, which also makes use of sql_type method, thence
+#  can ultimately trigger the assertion.
+#
+-- source include/stop_slave.inc
+SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY';
+-- source include/start_slave.inc
+
+SET SQL_LOG_BIN=0;
+CREATE TABLE t1 ( c1 varchar(255) DEFAULT NULL, KEY c1 (c1)) DEFAULT CHARSET=utf32;
+SET SQL_LOG_BIN=1;
+
+-- connection master
+
+INSERT INTO t1(c1) VALUES ('insert into t1');
+DROP TABLE t1;
+
+--sync_slave_with_master
+
+# assertion: the slave woul hit an/several assertions:
+#            before and during slave conversion procedure
+#            Now that is fixed, it wont.
+
+SET GLOBAL SLAVE_TYPE_CONVERSIONS= @saved_slave_type_conversions;
+-- source include/stop_slave.inc
+-- source include/start_slave.inc
+-- connection master

=== modified file 'sql/field.cc'
--- a/sql/field.cc	2010-03-01 19:02:51 +0000
+++ b/sql/field.cc	2010-03-11 11:06:31 +0000
@@ -6611,8 +6611,7 @@ uchar *Field_string::pack(uchar *to, con
     local_char_length= my_charpos(field_charset, from, from+length,
                                   local_char_length);
   set_if_smaller(length, local_char_length);
-  while (length && from[length-1] == field_charset->pad_char)
-    length--;
+  length= field_charset->cset->lengthsp(field_charset, (const char*) from, length);
 
   // Length always stored little-endian
   *to++= (uchar) length;
@@ -6678,7 +6677,7 @@ Field_string::unpack(uchar *to,
 
   memcpy(to, from, length);
   // Pad the string with the pad character of the fields charset
-  bfill(to + length, field_length - length, field_charset->pad_char);
+  field_charset->cset->fill(field_charset, (char*) to + length, field_length - length, field_charset->pad_char);
   return from+length;
 }
 

=== modified file 'sql/rpl_utility.cc'
--- a/sql/rpl_utility.cc	2010-02-22 13:42:40 +0000
+++ b/sql/rpl_utility.cc	2010-03-11 11:06:31 +0000
@@ -340,7 +340,7 @@ uint32 table_def::calc_field_size(uint c
 
 /**
  */
-void show_sql_type(enum_field_types type, uint16 metadata, String *str)
+void show_sql_type(enum_field_types type, uint16 metadata, String *str, CHARSET_INFO *field_cs)
 {
   DBUG_ENTER("show_sql_type");
   DBUG_PRINT("enter", ("type: %d, metadata: 0x%x", type, metadata));
@@ -489,7 +489,7 @@ void show_sql_type(enum_field_types type
       uint bytes= (((metadata >> 4) & 0x300) ^ 0x300) + (metadata & 0x00ff);
       uint32 length=
         cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
-                           "char(%d)", bytes / cs->mbmaxlen);
+                           "char(%d)", bytes / field_cs->mbmaxlen);
       str->length(length);
     }
     break;
@@ -579,7 +579,7 @@ can_convert_field_to(Field *field,
   DBUG_ENTER("can_convert_field_to");
 #ifndef DBUG_OFF
   char field_type_buf[MAX_FIELD_WIDTH];
-  String field_type(field_type_buf, sizeof(field_type_buf), field->charset());
+  String field_type(field_type_buf, sizeof(field_type_buf), &my_charset_latin1);
   field->sql_type(field_type);
   DBUG_PRINT("enter", ("field_type: %s, target_type: %d, source_type: %d, source_metadata: 0x%x",
                        field_type.c_ptr_safe(), field->real_type(), source_type, metadata));
@@ -823,9 +823,9 @@ table_def::compatible_with(THD *thd, Rel
       const char *tbl_name= table->s->table_name.str;
       char source_buf[MAX_FIELD_WIDTH];
       char target_buf[MAX_FIELD_WIDTH];
-      String source_type(source_buf, sizeof(source_buf), field->charset());
-      String target_type(target_buf, sizeof(target_buf), field->charset());
-      show_sql_type(type(col), field_metadata(col), &source_type);
+      String source_type(source_buf, sizeof(source_buf), &my_charset_latin1);
+      String target_type(target_buf, sizeof(target_buf), &my_charset_latin1);
+      show_sql_type(type(col), field_metadata(col), &source_type, field->charset());
       field->sql_type(target_type);
       rli->report(ERROR_LEVEL, ER_SLAVE_CONVERSION_FAILED,
                   ER(ER_SLAVE_CONVERSION_FAILED),
@@ -843,8 +843,8 @@ table_def::compatible_with(THD *thd, Rel
       {
         char source_buf[MAX_FIELD_WIDTH];
         char target_buf[MAX_FIELD_WIDTH];
-        String source_type(source_buf, sizeof(source_buf), table->field[col]->charset());
-        String target_type(target_buf, sizeof(target_buf), table->field[col]->charset());
+        String source_type(source_buf, sizeof(source_buf), &my_charset_latin1);
+        String target_type(target_buf, sizeof(target_buf), &my_charset_latin1);
         tmp_table->field[col]->sql_type(source_type);
         table->field[col]->sql_type(target_type);
         DBUG_PRINT("debug", ("Field %s - conversion required."


Attachment: [text/bzr-bundle] bzr/luis.soares@sun.com-20100311110631-r96kt02gxmly7bsc.bundle
Thread
bzr commit into mysql-6.0-codebase-bugfixing branch (luis.soares:3814)Bug#51716 Bug#51787Luis Soares11 Mar