List:Commits« Previous MessageNext Message »
From:Ingo Struewing Date:December 18 2007 12:29pm
Subject:bk commit into 5.0 tree (istruewing:1.2579) BUG#32705
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of istruewing. When istruewing does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-12-18 12:29:50+01:00, istruewing@stripped +3 -0
  Bug#32705 - myisam corruption: Key in wrong position
              at page 1024 with ucs2_bin
  
  Inserting strings with a common prefix into a table with
  characterset UCS2 corrupted the table.
  
  An efficient search method was used, which compares end space
  with ASCII blank. This doesn't work for character sets like UCS2,
  which do not encode blank like ASCII does.
  
  Use the less efficient search method _mi_seq_search()
  for charsets with mbminlen > 1.

  myisam/mi_open.c@stripped, 2007-12-18 12:29:47+01:00, istruewing@stripped +10 -1
    Bug#32705 - myisam corruption: Key in wrong position
                at page 1024 with ucs2_bin
    Use _mi_seq_search() for charsets with mbminlen > 1.

  mysql-test/r/myisam.result@stripped, 2007-12-18 12:29:47+01:00, istruewing@stripped +10
-0
    Bug#32705 - myisam corruption: Key in wrong position
                at page 1024 with ucs2_bin
    Added test result.

  mysql-test/t/myisam.test@stripped, 2007-12-18 12:29:47+01:00, istruewing@stripped +13 -0
    Bug#32705 - myisam corruption: Key in wrong position
                at page 1024 with ucs2_bin
    Added test.

diff -Nrup a/myisam/mi_open.c b/myisam/mi_open.c
--- a/myisam/mi_open.c	2007-11-14 11:37:22 +01:00
+++ b/myisam/mi_open.c	2007-12-18 12:29:47 +01:00
@@ -791,8 +791,17 @@ static void setup_key_functions(register
     keyinfo->get_key= _mi_get_pack_key;
     if (keyinfo->seg[0].flag & HA_PACK_KEY)
     {						/* Prefix compression */
+      /*
+        _mi_prefix_search() compares end-space against ASCII blank (' ').
+        It cannot be used for character sets, that do not encode the
+        blank character like ASCII does. UCS2 is an example. All
+        character sets with a fixed width > 1 or a mimimum width > 1
+        cannot represent blank like ASCII does. In these cases we have
+        to use _mi_seq_search() for the search.
+      */
       if (!keyinfo->seg->charset || use_strnxfrm(keyinfo->seg->charset) ||
-          (keyinfo->seg->flag & HA_NULL_PART))
+          (keyinfo->seg->flag & HA_NULL_PART) ||
+          (keyinfo->seg->charset->mbminlen > 1))
         keyinfo->bin_search=_mi_seq_search;
       else
         keyinfo->bin_search=_mi_prefix_search;
diff -Nrup a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
--- a/mysql-test/r/myisam.result	2007-11-14 12:02:18 +01:00
+++ b/mysql-test/r/myisam.result	2007-12-18 12:29:47 +01:00
@@ -1839,4 +1839,14 @@ CHECK TABLE t1 EXTENDED;
 Table	Op	Msg_type	Msg_text
 test.t1	check	status	OK
 DROP TABLE t1;
+CREATE TABLE t1 (
+c1 CHAR(255) CHARACTER SET UCS2 COLLATE UCS2_BIN NOT NULL,
+KEY(c1)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('marshall\'s');
+INSERT INTO t1 VALUES ('marsh');
+CHECK TABLE t1 EXTENDED;
+Table	Op	Msg_type	Msg_text
+test.t1	check	status	OK
+DROP TABLE t1;
 End of 5.0 tests
diff -Nrup a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
--- a/mysql-test/t/myisam.test	2007-11-14 12:02:18 +01:00
+++ b/mysql-test/t/myisam.test	2007-12-18 12:29:47 +01:00
@@ -1193,4 +1193,17 @@ SET @@myisam_repair_threads=1;
 CHECK TABLE t1 EXTENDED;
 DROP TABLE t1;
 
+#
+# Bug#32705 - myisam corruption: Key in wrong position
+#             at page 1024 with ucs2_bin
+#
+CREATE TABLE t1 (
+  c1 CHAR(255) CHARACTER SET UCS2 COLLATE UCS2_BIN NOT NULL,
+  KEY(c1)
+  ) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('marshall\'s');
+INSERT INTO t1 VALUES ('marsh');
+CHECK TABLE t1 EXTENDED;
+DROP TABLE t1;
+
 --echo End of 5.0 tests
Thread
bk commit into 5.0 tree (istruewing:1.2579) BUG#32705Ingo Struewing18 Dec