MDEV-25866 Upgrade from pre-10.5.10 to 10.5.10 causes CHECK errors on encrypted Aria tables

Hard to do a test case, but tested by hand and verified that mysql_upgrade
will update the encrypted MariaDB tables.
This commit is contained in:
Monty 2021-06-07 17:40:30 +03:00
parent eed419b487
commit bf5c050fd2
2 changed files with 21 additions and 0 deletions

View file

@ -4198,6 +4198,26 @@ int ha_maria::find_unique_row(uchar *record, uint constrain_no)
return rc;
}
/**
Check if a table needs to be repaired
*/
int ha_maria::check_for_upgrade(HA_CHECK_OPT *check)
{
if (table->s->mysql_version && table->s->mysql_version <= 100509 &&
(file->s->base.extra_options & MA_EXTRA_OPTIONS_ENCRYPTED))
{
/*
Encrypted tables before 10.5.9 had a bug where LSN was not
stored on the pages. These must be repaired!
*/
return HA_ADMIN_NEEDS_ALTER;
}
return HA_ADMIN_OK;
}
struct st_mysql_storage_engine maria_storage_engine=
{ MYSQL_HANDLERTON_INTERFACE_VERSION };

View file

@ -144,6 +144,7 @@ public:
int check(THD * thd, HA_CHECK_OPT * check_opt) override;
int analyze(THD * thd, HA_CHECK_OPT * check_opt) override;
int repair(THD * thd, HA_CHECK_OPT * check_opt) override;
int check_for_upgrade(HA_CHECK_OPT *check_opt) override;
bool check_and_repair(THD * thd) override final;
bool is_crashed() const override final;
bool is_changed() const;