List:Commits« Previous MessageNext Message »
From:Ramil Kalimullin Date:June 17 2008 10:13am
Subject:commit into mysql-5.1 branch (ramil:2664)
View as plain text  
#At file:///home/ram/mysql/b37310.5.1/

 2664 Ramil Kalimullin	2008-06-17
      Fix for bug #37310: 'on update CURRENT_TIMESTAMP' option crashes the table
      
      Problem: data consistency check (maximum record length) for a correct
      MyISAM table with CHECKSUM=1 and ROW_FORMAT=DYNAMIC option 
      may fail due to wrong inner MyISAM parameter. In result we may 
      have the table marked as 'corrupted'. 
      
      Fix: properly set MyISAM maximum record length parameter.
modified:
  mysql-test/r/myisam.result
  mysql-test/t/myisam.test
  storage/myisam/mi_create.c

per-file comments:
  storage/myisam/mi_create.c
    Fix for bug #37310: 'on update CURRENT_TIMESTAMP' option crashes the table
    
    Use HA_OPTION_PACK_RECORD instead of HA_PACK_RECORD (typo?) 
    calculating packed record length.
=== modified file 'mysql-test/r/myisam.result'
--- a/mysql-test/r/myisam.result	2008-05-13 12:01:02 +0000
+++ b/mysql-test/r/myisam.result	2008-06-17 08:13:04 +0000
@@ -1831,6 +1831,28 @@
 3	2
 4	5
 DROP TABLE t1, t2;
+CREATE TABLE t1 (a INT) ENGINE=MyISAM CHECKSUM=1 ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 VALUES (0);
+UPDATE t1 SET a=1;
+SELECT a FROM t1;
+a
+1
+CHECK TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	check	status	OK
+INSERT INTO t1 VALUES (0), (5), (4), (2);
+UPDATE t1 SET a=2;
+SELECT a FROM t1;
+a
+2
+2
+2
+2
+2
+CHECK TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	check	status	OK
+DROP TABLE t1;
 End of 5.0 tests
 create table t1 (a int not null, key `a` (a) key_block_size=1024);
 show create table t1;

=== modified file 'mysql-test/t/myisam.test'
--- a/mysql-test/t/myisam.test	2008-01-24 17:56:42 +0000
+++ b/mysql-test/t/myisam.test	2008-06-17 08:13:04 +0000
@@ -1169,6 +1169,20 @@
 
 DROP TABLE t1, t2;
 
+#
+# Bug#37310: 'on update CURRENT_TIMESTAMP' option crashes the table
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM CHECKSUM=1 ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 VALUES (0);
+UPDATE t1 SET a=1;
+SELECT a FROM t1;
+CHECK TABLE t1;
+INSERT INTO t1 VALUES (0), (5), (4), (2);
+UPDATE t1 SET a=2;
+SELECT a FROM t1;
+CHECK TABLE t1;
+DROP TABLE t1; 
+
 --echo End of 5.0 tests
 
 

=== modified file 'storage/myisam/mi_create.c'
--- a/storage/myisam/mi_create.c	2008-04-19 10:58:37 +0000
+++ b/storage/myisam/mi_create.c	2008-06-17 08:13:04 +0000
@@ -196,7 +196,7 @@
   packed=(packed+7)/8;
   if (pack_reclength != INT_MAX32)
     pack_reclength+= reclength+packed +
-      test(test_all_bits(options, HA_OPTION_CHECKSUM | HA_PACK_RECORD));
+      test(test_all_bits(options, HA_OPTION_CHECKSUM | HA_OPTION_PACK_RECORD));
   min_pack_length+=packed;
 
   if (!ci->data_file_length && ci->max_rows)

Thread
commit into mysql-5.1 branch (ramil:2664) Ramil Kalimullin17 Jun