List:Commits« Previous MessageNext Message »
From:Narayanan V Date:April 30 2009 12:46pm
Subject:bzr commit into mysql-5.1-bugteam branch (v.narayanan:2874) Bug#37631
View as plain text  
#At file:///export/home/log/Narayanan/mysql_checkouts_bazaar/5.1_main_repository/mysql-5.1-bugteam-37631-6/ based on revid:gshchepa@stripped

 2874 Narayanan V	2009-04-30
      BUG#37631 - Incorrect key file for table after upgrading from 5.0 to 5.1
      
      This patch adds corrections to the original patch
      submitted 2009-04-08 (http://lists.mysql.com/commits/71607):
      
      - fixed that the original patch didn't work because of an
        incorrect condition;
      - added a test case.
     @ mysql-test/r/upgrade.result
        Bug#37631 Incorrect key file for table after upgrading from 5.0 to 5.1
        
        Result file for test case
     @ mysql-test/std_data/bug37631.MYD
        Bug#37631 Incorrect key file for table after upgrading from 5.0 to 5.1
        
        table created in mysql 4.0
     @ mysql-test/std_data/bug37631.MYI
        Bug#37631 Incorrect key file for table after upgrading from 5.0 to 5.1
        
        table created in mysql 4.0
     @ mysql-test/std_data/bug37631.frm
        Bug#37631 Incorrect key file for table after upgrading from 5.0 to 5.1
        
        table created in mysql 4.0
     @ mysql-test/t/upgrade.test
        Bug#37631 Incorrect key file for table after upgrading from 5.0 to 5.1
        
        Adds test for checking that upgrade works
        on a table which is created by a mysql
        server version <= 4.0.
     @ storage/myisam/ha_myisam.cc
        Bug#37631 Incorrect key file for table after upgrading from 5.0 to 5.1
        
        Fix the conformance checker to relax checking
        for the correct version of the tables (for tables
        created by mysql server version <= 4.0)

    added:
      mysql-test/std_data/bug37631.MYD
      mysql-test/std_data/bug37631.MYI
      mysql-test/std_data/bug37631.frm
    modified:
      mysql-test/r/upgrade.result
      mysql-test/t/upgrade.test
      storage/myisam/ha_myisam.cc
=== modified file 'mysql-test/r/upgrade.result'
--- a/mysql-test/r/upgrade.result	2009-04-10 09:25:48 +0000
+++ b/mysql-test/r/upgrade.result	2009-04-30 12:46:49 +0000
@@ -57,6 +57,18 @@ s1
 1
 drop table `txu@0023p@0023p1`;
 drop table `txu#p#p1`;
+#
+# Bug#37631 Incorrect key file for table after upgrading from 5.0 to 5.1
+#
+# copy table created using mysql4.0 into the data dir
+# check the table created using mysql 4.0
+CHECK TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	check	error	Table upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
+# query the table created using mysql 4.0
+SELECT * FROM t1;
+c1	c2	c3
+DROP TABLE t1;
 truncate t1;
 drop table t1;
 drop database if exists `tabc`;

=== added file 'mysql-test/std_data/bug37631.MYD'

=== added file 'mysql-test/std_data/bug37631.MYI'
Binary files a/mysql-test/std_data/bug37631.MYI	1970-01-01 00:00:00 +0000 and b/mysql-test/std_data/bug37631.MYI	2009-04-30 12:46:49 +0000 differ

=== added file 'mysql-test/std_data/bug37631.frm'
Binary files a/mysql-test/std_data/bug37631.frm	1970-01-01 00:00:00 +0000 and b/mysql-test/std_data/bug37631.frm	2009-04-30 12:46:49 +0000 differ

=== modified file 'mysql-test/t/upgrade.test'
--- a/mysql-test/t/upgrade.test	2009-04-13 13:09:10 +0000
+++ b/mysql-test/t/upgrade.test	2009-04-30 12:46:49 +0000
@@ -48,6 +48,20 @@ select * from `txu#p#p1`;
 drop table `txu@0023p@0023p1`;
 drop table `txu#p#p1`;
 
+--echo #
+--echo # Bug#37631 Incorrect key file for table after upgrading from 5.0 to 5.1
+--echo #
+--echo # copy table created using mysql4.0 into the data dir
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+copy_file std_data/bug37631.frm $MYSQLD_DATADIR/test/t1.frm;
+copy_file std_data/bug37631.MYD $MYSQLD_DATADIR/test/t1.MYD;
+copy_file std_data/bug37631.MYI $MYSQLD_DATADIR/test/t1.MYI;
+--echo # check the table created using mysql 4.0
+CHECK TABLE t1;
+--echo # query the table created using mysql 4.0
+SELECT * FROM t1;
+DROP TABLE t1;
+
 #
 # Check if old tables work
 #

=== modified file 'storage/myisam/ha_myisam.cc'
--- a/storage/myisam/ha_myisam.cc	2009-04-08 06:55:19 +0000
+++ b/storage/myisam/ha_myisam.cc	2009-04-30 12:46:49 +0000
@@ -392,7 +392,7 @@ int check_definition(MI_KEYDEF *t1_keyin
                             test(t2_keyinfo[i].flag & HA_SPATIAL)));
        DBUG_RETURN(1);
     }
-    if ((mysql_40_compat &&
+    if ((!mysql_40_compat &&
         t1_keyinfo[i].key_alg != t2_keyinfo[i].key_alg) ||
         t1_keyinfo[i].keysegs != t2_keyinfo[i].keysegs)
     {
@@ -424,7 +424,7 @@ int check_definition(MI_KEYDEF *t1_keyin
           t1_keysegs_j__type= HA_KEYTYPE_VARBINARY1; /* purecov: inspected */
       }
 
-      if ((mysql_40_compat &&
+      if ((!mysql_40_compat &&
           t1_keysegs[j].language != t2_keysegs[j].language) ||
           t1_keysegs_j__type != t2_keysegs[j].type ||
           t1_keysegs[j].null_bit != t2_keysegs[j].null_bit ||


Attachment: [text/bzr-bundle] bzr/v.narayanan@sun.com-20090430124649-kyvb002vq842gdnl.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (v.narayanan:2874) Bug#37631Narayanan V30 Apr