While trying to recover a corrupted ARCHIVE table, my searching lead me here. Posting my findings in case it also helps someone in the future. (Note that archive_reader is not specific to this fork - this fork is just where I was lead.)
Patched code with:
diff --git a/storage/archive/CMakeLists.txt b/storage/archive/CMakeLists.txt
index 78fb95c0d2..799ad44a6f 100644
--- a/storage/archive/CMakeLists.txt
+++ b/storage/archive/CMakeLists.txt
@@ -16,3 +16,5 @@
SET(ARCHIVE_SOURCES azio.c ha_archive.cc ha_archive.h)
MYSQL_ADD_PLUGIN(archive ${ARCHIVE_SOURCES} STORAGE_ENGINE LINK_LIBRARIES ${ZLIB_LIBRARY})
+MYSQL_ADD_EXECUTABLE(archive_reader archive_reader.c azio.c)
+TARGET_LINK_LIBRARIES(archive_reader mysys)
diff --git a/storage/archive/archive_reader.c b/storage/archive/archive_reader.c
index 2475418fef..7a3fd792c7 100644
--- a/storage/archive/archive_reader.c
+++ b/storage/archive/archive_reader.c
@@ -39,6 +39,8 @@ static char **default_argv;
int opt_check, opt_force, opt_quiet, opt_backup= 0, opt_extract_frm;
int opt_autoincrement;
+PSI_file_key arch_key_file_metadata, arch_key_file_data, arch_key_file_frm;
+
int main(int argc, char *argv[])
{
unsigned int ret;
- Compiled with
cmake && make archive_reader -j4.
- Shutdown MySQL/MariaDB server (should work with either; I do not think anyone has worked on the ARCHIVE engine for over a decade).
- Backup your mysql data dir in case something goes wrong.
- Rebuild the
<table-name>.ARZ with archive_reader --backup path/to/table.ARZ new-file.ARZ.
- Replace
<table-name>.ARZ with the new file.
- If
<table-name>.ARN exists, delete it.
- Start up the db server.
- Before doing anything else,
mysqldump the table.
- The server thinks the table is valid, so even if corruption was not repaired, you should still be able to dump data up to the point where it had an issue. Can load this dump later, if need be.
- If there were no errors, hopefully everything is good to go.
We found ARCHIVE engine to be 6x smaller than compressed InnoDB (and 10x smaller than uncompressed), so still has value. If you too must stay with ARCHIVE, I recommend FLUSHing the table after completing any major write.
While trying to recover a corrupted ARCHIVE table, my searching lead me here. Posting my findings in case it also helps someone in the future. (Note that
archive_readeris not specific to this fork - this fork is just where I was lead.)Patched code with:
cmake && make archive_reader -j4.<table-name>.ARZwitharchive_reader --backup path/to/table.ARZ new-file.ARZ.<table-name>.ARZwith the new file.<table-name>.ARNexists, delete it.mysqldumpthe table.We found ARCHIVE engine to be 6x smaller than compressed InnoDB (and 10x smaller than uncompressed), so still has value. If you too must stay with ARCHIVE, I recommend
FLUSHing the table after completing any major write.