diff options
Diffstat (limited to 'storage/maria')
-rw-r--r-- | storage/maria/ha_maria.cc | 20 | ||||
-rw-r--r-- | storage/maria/ha_maria.h | 1 | ||||
-rw-r--r-- | storage/maria/ma_check.c | 10 |
3 files changed, 29 insertions, 2 deletions
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index e13302d9750..2c8a67998dd 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -4208,6 +4208,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; diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index a312c959e3a..acc1382689a 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -3417,6 +3417,9 @@ static my_bool maria_zerofill_index(HA_CHECK *param, MARIA_HA *info, my_bool zero_lsn= (share->base.born_transactional && !(param->testflag & T_ZEROFILL_KEEP_LSN)); int error= 1; + enum pagecache_page_type page_type= (share->base.born_transactional ? + PAGECACHE_LSN_PAGE : + PAGECACHE_PLAIN_PAGE); DBUG_ENTER("maria_zerofill_index"); if (!(param->testflag & T_SILENT)) @@ -3431,7 +3434,7 @@ static my_bool maria_zerofill_index(HA_CHECK *param, MARIA_HA *info, if (!(buff= pagecache_read(share->pagecache, &share->kfile, page, DFLT_INIT_HITS, 0, - PAGECACHE_PLAIN_PAGE, PAGECACHE_LOCK_WRITE, + page_type, PAGECACHE_LOCK_WRITE, &page_link.link))) { pagecache_unlock_by_link(share->pagecache, page_link.link, @@ -3508,6 +3511,9 @@ static my_bool maria_zerofill_data(HA_CHECK *param, MARIA_HA *info, uint block_size= share->block_size; MARIA_FILE_BITMAP *bitmap= &share->bitmap; my_bool zero_lsn= !(param->testflag & T_ZEROFILL_KEEP_LSN), error; + enum pagecache_page_type read_page_type= (share->base.born_transactional ? + PAGECACHE_LSN_PAGE : + PAGECACHE_PLAIN_PAGE); DBUG_ENTER("maria_zerofill_data"); /* This works only with BLOCK_RECORD files */ @@ -3531,7 +3537,7 @@ static my_bool maria_zerofill_data(HA_CHECK *param, MARIA_HA *info, if (!(buff= pagecache_read(share->pagecache, &info->dfile, page, 1, 0, - PAGECACHE_PLAIN_PAGE, PAGECACHE_LOCK_WRITE, + read_page_type, PAGECACHE_LOCK_WRITE, &page_link.link))) { _ma_check_print_error(param, |