diff options
author | Sergey Vojtovich <svoj@sun.com> | 2010-03-25 23:57:06 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@sun.com> | 2010-03-25 23:57:06 +0400 |
commit | 298c067eeede9e086252390856c990633fe08231 (patch) | |
tree | 8da5e1f608ff17dba1f228baa4f37aa749ac116a /storage/archive | |
parent | ad6e00e3b2b9bf26805c90cbd7655c6d2b20cab4 (diff) | |
download | mariadb-git-298c067eeede9e086252390856c990633fe08231.tar.gz |
BUG#46565 - repair of partition fail for archive engine
There was no way to repair corrupt ARCHIVE data file,
when unrecoverable data loss is inevitable.
With this fix REPAIR ... EXTENDED attempts to restore
as much rows as possible, ignoring unrecoverable data.
Normal REPAIR is still able to repair meta-data file
only.
mysql-test/r/archive.result:
A test case for BUG#46565.
mysql-test/std_data/bug46565.ARZ:
A test case for BUG#46565.
mysql-test/std_data/bug46565.frm:
A test case for BUG#46565.
mysql-test/t/archive.test:
A test case for BUG#46565.
storage/archive/ha_archive.cc:
Allow unrecoverable data loss when extended repair
is requested.
Diffstat (limited to 'storage/archive')
-rw-r--r-- | storage/archive/ha_archive.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index 364ffba0f6c..988337ec50e 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -1269,13 +1269,12 @@ int ha_archive::rnd_pos(uchar * buf, uchar *pos) /* This method repairs the meta file. It does this by walking the datafile and - rewriting the meta file. Currently it does this by calling optimize with - the extended flag. + rewriting the meta file. If EXTENDED repair is requested, we attempt to + recover as much data as possible. */ int ha_archive::repair(THD* thd, HA_CHECK_OPT* check_opt) { DBUG_ENTER("ha_archive::repair"); - check_opt->flags= T_EXTEND; int rc= optimize(thd, check_opt); if (rc) @@ -1369,7 +1368,14 @@ int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt) DBUG_PRINT("ha_archive", ("recovered %llu archive rows", (unsigned long long)share->rows_recorded)); - if (rc && rc != HA_ERR_END_OF_FILE) + /* + If REPAIR ... EXTENDED is requested, try to recover as much data + from data file as possible. In this case if we failed to read a + record, we assume EOF. This allows massive data loss, but we can + hardly do more with broken zlib stream. And this is the only way + to restore at least what is still recoverable. + */ + if (rc && rc != HA_ERR_END_OF_FILE && !(check_opt->flags & T_EXTEND)) goto error; } |