mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 20:07:13 +02:00
Bug #47012 archive tables are not upgradeable, and server crashes
on any access Archive engine for 5.1 (and latter) version uses a modified version of zlib (azlib). These two version are incompatible so a proper upgrade is needed before tables created in 5.0 can be used reliable. This upgrade can be performed using repair. But due to lack of test its risky to allow upgrade for now. This patch addresses only the crashing issue. Any attempt to repair will be blocked. Eventually repair can be allowed to run through (which will also cause an upgrade from older version to newer) but only after a thorough testing. mysql-test/r/archive.result: Updated result file for test case for bug#47012 mysql-test/std_data/bug47012.ARM: part of archive table (t1) created in mysql 5.0 mysql-test/std_data/bug47012.ARZ: part of archive table (t1) created in mysql 5.0 mysql-test/std_data/bug47012.frm: part of archive table (t1) created in mysql 5.0 mysql-test/t/archive.test: Added test case for bug#47012. storage/archive/azio.c: Fixed a minor issues (minor version overwriting version in stream structure) Removed assertion when an older version is found. Instead setting the correct version (2) in s->version If an unknown version is found marked it as corrupt. storage/archive/ha_archive.cc: Detecting the archive version in getShare and marking it as need to upgrade. Blocking open if the archive needs an upgrade. This can be allowed in case of open for repair to upgrade the archive but needs to tested.
This commit is contained in:
parent
313c5a01ee
commit
c87375150b
7 changed files with 60 additions and 5 deletions
|
|
@ -360,6 +360,12 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, int *rc)
|
|||
stats.auto_increment_value= archive_tmp.auto_increment + 1;
|
||||
share->rows_recorded= (ha_rows)archive_tmp.rows;
|
||||
share->crashed= archive_tmp.dirty;
|
||||
/*
|
||||
If archive version is less than 3, It should be upgraded before
|
||||
use.
|
||||
*/
|
||||
if (archive_tmp.version < ARCHIVE_VERSION)
|
||||
*rc= HA_ERR_TABLE_NEEDS_UPGRADE;
|
||||
azclose(&archive_tmp);
|
||||
|
||||
VOID(my_hash_insert(&archive_open_tables, (uchar*) share));
|
||||
|
|
@ -491,7 +497,15 @@ int ha_archive::open(const char *name, int mode, uint open_options)
|
|||
(open_options & HA_OPEN_FOR_REPAIR) ? "yes" : "no"));
|
||||
share= get_share(name, &rc);
|
||||
|
||||
if (rc == HA_ERR_CRASHED_ON_USAGE && !(open_options & HA_OPEN_FOR_REPAIR))
|
||||
/*
|
||||
Allow open on crashed table in repair mode only.
|
||||
Block open on 5.0 ARCHIVE table. Though we have almost all
|
||||
routines to access these tables, they were not well tested.
|
||||
For now we have to refuse to open such table to avoid
|
||||
potential data loss.
|
||||
*/
|
||||
if ((rc == HA_ERR_CRASHED_ON_USAGE && !(open_options & HA_OPEN_FOR_REPAIR))
|
||||
|| rc == HA_ERR_TABLE_NEEDS_UPGRADE)
|
||||
{
|
||||
/* purecov: begin inspected */
|
||||
free_share();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue