List:Commits« Previous MessageNext Message »
From:Luis Soares Date:October 20 2010 11:41am
Subject:bzr commit into mysql-trunk-bugfixing branch (luis.soares:3288)
View as plain text  
#At file:///home/lsoares/Workspace/bzr/work/bugfixing/53386/mysql-trunk-bugfixing/ based on revid:alfranio.correia@stripped

 3288 Luis Soares	2010-10-20
      Bug 53386: Work in progress.
      
      CHAR(255) CHARACTER SET UTF8 takes: 
      
        255 * field_charset->mbmaxlen (3) = 765
      
      thence uses two bytes to store the length (see 
      Field_string::pack). The table_def::calc_field_size
      considers only 1 byte always.

    added:
      mysql-test/suite/rpl/t/rpl_bug53386.test
    modified:
      sql/rpl_utility.cc
=== added file 'mysql-test/suite/rpl/t/rpl_bug53386.test'
--- a/mysql-test/suite/rpl/t/rpl_bug53386.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_bug53386.test	2010-10-20 11:41:18 +0000
@@ -0,0 +1,19 @@
+-- source include/master-slave.inc
+-- source include/have_binlog_format_row.inc
+
+# CREATE Different tables on master and slave
+SET SQL_LOG_BIN=0;
+CREATE TABLE t1 (c1 INT NOT NULL, c2 CHAR(86) CHARACTER SET UTF8 NOT NULL) ENGINE=MyISAM;
+SET SQL_LOG_BIN=1;
+-- connection slave
+CREATE TABLE t1 (c1 INT) ENGINE=MyISAM;
+
+# insert empty row
+-- connection master
+INSERT INTO t1 VALUES ();
+-- sync_slave_with_master
+
+# clean up
+-- connection master
+DROP TABLE t1;
+-- sync_slave_with_master

=== modified file 'sql/rpl_utility.cc'
--- a/sql/rpl_utility.cc	2010-07-16 21:00:50 +0000
+++ b/sql/rpl_utility.cc	2010-10-20 11:41:18 +0000
@@ -225,9 +225,10 @@ uint32 table_def::calc_field_size(uint c
       /*
         We are reading the actual size from the master_data record
         because this field has the actual lengh stored in the first
-        byte.
+        one or two bytes.
       */
-      length= (uint) *master_data + 1;
+      length= (uint) m_field_metadata[col] > 255 ? 2 : 1; // c&p of Field_varstring::data_length()
+      length+= length == 1 ? (uint32) *master_data : uint2korr(master_data);
       DBUG_ASSERT(length != 0);
     }
     break;


Attachment: [text/bzr-bundle] bzr/luis.soares@oracle.com-20101020114118-dnryudyb6x6fbci2.bundle
Thread
bzr commit into mysql-trunk-bugfixing branch (luis.soares:3288) Luis Soares20 Oct