diff options
author | Satya B <satya.bn@sun.com> | 2009-03-18 11:16:21 +0530 |
---|---|---|
committer | Satya B <satya.bn@sun.com> | 2009-03-18 11:16:21 +0530 |
commit | 497db6ac0f1efb1a962158d9ee108b0236b88e5c (patch) | |
tree | 266da795b85d6136282fe29653027e0a53cc7301 | |
parent | da3c4375cfe9530c04525ff6694e5f59f354c144 (diff) | |
download | mariadb-git-497db6ac0f1efb1a962158d9ee108b0236b88e5c.tar.gz |
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.
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
-rw-r--r-- | mysql-test/r/archive.result | 19 | ||||
-rw-r--r-- | mysql-test/std_data/bug32880.ARN | bin | 0 -> 131 bytes | |||
-rw-r--r-- | mysql-test/std_data/bug32880.ARZ | bin | 0 -> 8744 bytes | |||
-rw-r--r-- | mysql-test/std_data/bug32880.frm | bin | 0 -> 8578 bytes | |||
-rw-r--r-- | mysql-test/t/archive.test | 15 | ||||
-rw-r--r-- | storage/archive/ha_archive.cc | 6 |
6 files changed, 36 insertions, 4 deletions
diff --git a/mysql-test/r/archive.result b/mysql-test/r/archive.result index 8c26ea1ff82..02acccb234e 100644 --- a/mysql-test/r/archive.result +++ b/mysql-test/r/archive.result @@ -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; diff --git a/mysql-test/std_data/bug32880.ARN b/mysql-test/std_data/bug32880.ARN Binary files differnew file mode 100644 index 00000000000..643b0dfbad5 --- /dev/null +++ b/mysql-test/std_data/bug32880.ARN diff --git a/mysql-test/std_data/bug32880.ARZ b/mysql-test/std_data/bug32880.ARZ Binary files differnew file mode 100644 index 00000000000..4e151822647 --- /dev/null +++ b/mysql-test/std_data/bug32880.ARZ diff --git a/mysql-test/std_data/bug32880.frm b/mysql-test/std_data/bug32880.frm Binary files differnew file mode 100644 index 00000000000..66a4c7d7538 --- /dev/null +++ b/mysql-test/std_data/bug32880.frm diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test index 7139d95ab49..0d521f95b38 100644 --- a/mysql-test/t/archive.test +++ b/mysql-test/t/archive.test @@ -1599,3 +1599,18 @@ INSERT INTO t1 VALUES (NULL, 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; diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index 7edfca53751..d20ab3bf723 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -1076,11 +1076,9 @@ int ha_archive::unpack_row(azio_stream *file_to_read, uchar *record) 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_CHECK_OPT* check_opt) 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); |