summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2021-06-07 17:40:30 +0300
committerMonty <monty@mariadb.org>2021-06-07 20:51:32 +0300
commitbf5c050fd28f616d789a02b0fbd6fd8ff53c78d3 (patch)
treed7fa57cb2986f0ef0c9a9f932c956e60bf583ed5
parenteed419b487dd6f555cdfd92aa0756fdec1b9060f (diff)
downloadmariadb-git-bf5c050fd28f616d789a02b0fbd6fd8ff53c78d3.tar.gz
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.
-rw-r--r--storage/maria/ha_maria.cc20
-rw-r--r--storage/maria/ha_maria.h1
2 files changed, 21 insertions, 0 deletions
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index 79d32886659..5bf6754ff9d 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -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 };
diff --git a/storage/maria/ha_maria.h b/storage/maria/ha_maria.h
index b2c664a072d..6b4302145dd 100644
--- a/storage/maria/ha_maria.h
+++ b/storage/maria/ha_maria.h
@@ -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;