List:Commits« Previous MessageNext Message »
From:jani Date:May 15 2006 6:38pm
Subject:bk commit into 5.1 tree (jani:1.2397) BUG#19386
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of jani. When jani 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
  1.2397 06/05/15 19:38:11 jani@stripped +3 -0
  Fix, or a workaround for Bug#19386 "Multiple alter causes crashed table"
  
  The problem is that in a MyISAM table the following column
  after a varchar field gets corrupted, if varchar field is
  extended.
  
  This should be made to work without a copy in the future, but
  I'm not sure if this code is ready yet. This fix will force copy
  in this case. It will not do any harm to have it here, only makes
  alter table a bit slower in this case. If this should work for
  MyISAM, then the bug is somewhere else in that code.
  
  Until it works, I propose this as a temporary fix or a workaround.
  Test case for the bug has been added.

  sql/ha_myisam.cc
    1.181 06/05/15 19:38:03 jani@stripped +2 -1
    For MyISAM type, if varchar column is extended, it should return not
    compatible for now. In other words, it forces a copy of the table during
    alter table.

  mysql-test/t/alter_table.test
    1.49 06/05/15 19:38:03 jani@stripped +13 -0
    Added test case for Bug#19386: Multiple alter causes crashed table.

  mysql-test/r/alter_table.result
    1.64 06/05/15 19:38:03 jani@stripped +10 -0
    Added test case for Bug#19386: Multiple alter causes crashed table.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jani
# Host:	a193-229-222-105.elisa-laajakaista.fi
# Root:	/home/my/bk/mysql-5.1-new

--- 1.180/sql/ha_myisam.cc	2006-05-04 19:39:42 +03:00
+++ 1.181/sql/ha_myisam.cc	2006-05-15 19:38:03 +03:00
@@ -1786,7 +1786,8 @@
   if (info->auto_increment_value != auto_increment_value ||
       info->data_file_name != data_file_name ||
       info->index_file_name != index_file_name ||
-      table_changes == IS_EQUAL_NO)
+      table_changes == IS_EQUAL_NO ||
+      table_changes & IS_EQUAL_PACK_LENGTH) // Not implemented yet
     return COMPATIBLE_DATA_NO;
 
   if ((options & (HA_OPTION_PACK_RECORD | HA_OPTION_CHECKSUM |

--- 1.63/mysql-test/r/alter_table.result	2006-03-15 10:14:30 +02:00
+++ 1.64/mysql-test/r/alter_table.result	2006-05-15 19:38:03 +03:00
@@ -647,3 +647,13 @@
 LENGTH(s)
 10
 DROP TABLE t1;
+CREATE TABLE t1 (v VARCHAR(3), b INT);
+INSERT INTO t1 VALUES ('abc', 5);
+SELECT * FROM t1;
+v	b
+abc	5
+ALTER TABLE t1 MODIFY COLUMN v VARCHAR(4);
+SELECT * FROM t1;
+v	b
+abc	5
+DROP TABLE t1;

--- 1.48/mysql-test/t/alter_table.test	2006-03-15 10:14:30 +02:00
+++ 1.49/mysql-test/t/alter_table.test	2006-05-15 19:38:03 +03:00
@@ -469,3 +469,16 @@
 SELECT HEX(s) FROM t1;
 SELECT LENGTH(s) FROM t1;
 DROP TABLE t1;
+
+#
+# Bug#19386: Multiple alter causes crashed table
+# The trailing column would get corrupted data, or server could not even read
+# it.
+#
+
+CREATE TABLE t1 (v VARCHAR(3), b INT);
+INSERT INTO t1 VALUES ('abc', 5);
+SELECT * FROM t1;
+ALTER TABLE t1 MODIFY COLUMN v VARCHAR(4);
+SELECT * FROM t1;
+DROP TABLE t1;
Thread
bk commit into 5.1 tree (jani:1.2397) BUG#19386jani15 May