List:Commits« Previous MessageNext Message »
From:Satya B Date:March 18 2009 5:46am
Subject:bzr commit into mysql-5.1-bugteam branch (satya.bn:2820) Bug#32880
View as plain text  
#At file:///home/satya/WORK/mysql-5.1-bugteam-32880/ based on revid:davi.arnaut@stripped

 2820 Satya B	2009-03-18
      Fix for BUG#32880 - Repairing Archive table fails with internal error 144
      
      Any statement reading corrupt archive data file
      (CHECK/REPAIR/SELECT/UPDATE/DELETE) may cause assertion
      failure in debug builds. This assertion has been removed
      and an error is returned instead.
      
      Also fixed that CHECK/REPAIR returns vague error message
      when it mets corruption in archive data file. This is
      fixed by returning proper error code.
      added:
        mysql-test/std_data/bug32880.ARN
        mysql-test/std_data/bug32880.ARZ
        mysql-test/std_data/bug32880.frm
      modified:
        mysql-test/r/archive.result
        mysql-test/t/archive.test
        storage/archive/ha_archive.cc

per-file messages:
  mysql-test/r/archive.result
    A test case for BUG#32880
  mysql-test/std_data/bug32880.ARN
    corrupted archive table to test check and repair table operation
  mysql-test/std_data/bug32880.ARZ
    corrupted archive table to test check and repair table operation
  mysql-test/std_data/bug32880.frm
    corrupted archive table to test check and repair table operation
  mysql-test/t/archive.test
    A test case for BUG#32880
  storage/archive/ha_archive.cc
    Fixed unpack_row() to return the error instead of throwing assertion 
    and also fixed repair() to throw better error when repair table
    operation fails on corrupted archive table
=== modified file 'mysql-test/r/archive.result'
--- a/mysql-test/r/archive.result	2008-03-14 16:59:03 +0000
+++ b/mysql-test/r/archive.result	2009-03-18 05:46:21 +0000
@@ -12695,3 +12695,22 @@ a	b
 1	NULL
 2	NULL
 DROP TABLE t1;
+#
+# BUG#32880 - Repairing Archive table fails with internal error 144
+#
+
+# Test with an existing table which is corrupted
+# Copy t1 from std_data
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` blob
+) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
+CHECK TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	check	error	Corrupt
+REPAIR TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	repair	error	Corrupt
+DROP TABLE t1;

=== added file 'mysql-test/std_data/bug32880.ARN'
Binary files a/mysql-test/std_data/bug32880.ARN	1970-01-01 00:00:00 +0000 and b/mysql-test/std_data/bug32880.ARN	2009-03-18 05:46:21 +0000 differ

=== added file 'mysql-test/std_data/bug32880.ARZ'
Binary files a/mysql-test/std_data/bug32880.ARZ	1970-01-01 00:00:00 +0000 and b/mysql-test/std_data/bug32880.ARZ	2009-03-18 05:46:21 +0000 differ

=== added file 'mysql-test/std_data/bug32880.frm'
Binary files a/mysql-test/std_data/bug32880.frm	1970-01-01 00:00:00 +0000 and b/mysql-test/std_data/bug32880.frm	2009-03-18 05:46:21 +0000 differ

=== modified file 'mysql-test/t/archive.test'
--- a/mysql-test/t/archive.test	2008-03-14 16:59:03 +0000
+++ b/mysql-test/t/archive.test	2009-03-18 05:46:21 +0000
@@ -1599,3 +1599,18 @@ INSERT INTO t1 VALUES (NULL, NULL),(NULL
 FLUSH TABLE t1;
 SELECT * FROM t1 ORDER BY a;
 DROP TABLE t1;
+
+--echo #
+--echo # BUG#32880 - Repairing Archive table fails with internal error 144
+--echo #
+--echo 
+--echo # Test with an existing table which is corrupted
+--echo # Copy t1 from std_data
+let $MYSQLD_DATADIR= `select @@datadir`;
+copy_file std_data/bug32880.frm $MYSQLD_DATADIR/test/t1.frm;
+copy_file std_data/bug32880.ARZ $MYSQLD_DATADIR/test/t1.ARZ;
+copy_file std_data/bug32880.ARN $MYSQLD_DATADIR/test/t1.ARN;
+SHOW CREATE TABLE t1;
+CHECK TABLE t1;
+REPAIR TABLE t1;
+DROP TABLE t1;

=== modified file 'storage/archive/ha_archive.cc'
--- a/storage/archive/ha_archive.cc	2008-10-03 18:08:40 +0000
+++ b/storage/archive/ha_archive.cc	2009-03-18 05:46:21 +0000
@@ -1076,11 +1076,9 @@ int ha_archive::unpack_row(azio_stream *
 
   read= azread(file_to_read, record_buffer->buffer, row_len, &error);
 
-  DBUG_ASSERT(row_len == read);
-
   if (read != row_len || error)
   {
-    DBUG_RETURN(-1);
+    DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
   }
 
   /* Copy null bits */
@@ -1257,7 +1255,7 @@ int ha_archive::repair(THD* thd, HA_CHEC
   int rc= optimize(thd, check_opt);
 
   if (rc)
-    DBUG_RETURN(HA_ERR_CRASHED_ON_REPAIR);
+    DBUG_RETURN(HA_ADMIN_CORRUPT);
 
   share->crashed= FALSE;
   DBUG_RETURN(0);

Thread
bzr commit into mysql-5.1-bugteam branch (satya.bn:2820) Bug#32880Satya B18 Mar