diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-05-29 11:32:46 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-05-29 11:32:46 +0300 |
commit | 90a91936852368774559a3ef2660e63e1e6f50e3 (patch) | |
tree | 97004f253bea0db37606928b592ae3bc70fa6672 /storage/innobase/buf | |
parent | fcb68ffe3dfb1c841852bd62a9aac9708888f4e9 (diff) | |
parent | 6eefeb6fea05ff17d010d173ef244a1d92078d71 (diff) | |
download | mariadb-git-90a91936852368774559a3ef2660e63e1e6f50e3.tar.gz |
Merge 10.2 into 10.3
Diffstat (limited to 'storage/innobase/buf')
-rw-r--r-- | storage/innobase/buf/buf0buf.cc | 51 | ||||
-rw-r--r-- | storage/innobase/buf/buf0lru.cc | 8 |
2 files changed, 44 insertions, 15 deletions
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index cbbfb181f24..a03c0083320 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -4424,6 +4424,11 @@ loop: return (NULL); } + if (local_err == DB_PAGE_CORRUPTED + && srv_force_recovery) { + return NULL; + } + /* Try to set table as corrupted instead of asserting. */ if (page_id.space() == TRX_SYS_SPACE) { @@ -5790,10 +5795,27 @@ buf_page_monitor( } /** Mark a table corrupted. +Also remove the bpage from LRU list. +@param[in] bpage Corrupted page. */ +static void buf_mark_space_corrupt(buf_page_t* bpage, const fil_space_t* space) +{ + /* If block is not encrypted find the table with specified + space id, and mark it corrupted. Encrypted tables + are marked unusable later e.g. in ::open(). */ + if (!bpage->encrypted) { + dict_set_corrupted_by_space(space); + } else { + dict_set_encrypted_by_space(space); + } +} + +/** Mark a table corrupted. +@param[in] bpage Corrupted page +@param[in] space Corrupted page belongs to tablespace Also remove the bpage from LRU list. */ static void -buf_mark_space_corrupt(buf_page_t* bpage, const fil_space_t* space) +buf_corrupt_page_release(buf_page_t* bpage, const fil_space_t* space) { buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); const ibool uncompressed = (buf_page_get_state(bpage) @@ -5817,13 +5839,8 @@ buf_mark_space_corrupt(buf_page_t* bpage, const fil_space_t* space) mutex_exit(buf_page_get_mutex(bpage)); - /* If block is not encrypted find the table with specified - space id, and mark it corrupted. Encrypted tables - are marked unusable later e.g. in ::open(). */ - if (!bpage->encrypted) { - dict_set_corrupted_by_space(space); - } else { - dict_set_encrypted_by_space(space); + if (!srv_force_recovery) { + buf_mark_space_corrupt(bpage, space); } /* After this point bpage can't be referenced. */ @@ -6025,7 +6042,7 @@ database_corrupted: "buf_page_import_corrupt_failure", if (!is_predefined_tablespace( bpage->id.space())) { - buf_mark_space_corrupt(bpage, space); + buf_corrupt_page_release(bpage, space); ib::info() << "Simulated IMPORT " "corruption"; space->release_for_io(); @@ -6059,7 +6076,7 @@ database_corrupted: << FORCE_RECOVERY_MSG; } - if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) { + if (!srv_force_recovery) { /* If page space id is larger than TRX_SYS_SPACE (0), we will attempt to mark the corresponding @@ -6069,7 +6086,7 @@ database_corrupted: " a corrupt database page."; } - buf_mark_space_corrupt(bpage, space); + buf_corrupt_page_release(bpage, space); space->release_for_io(); return(err); } @@ -6078,6 +6095,18 @@ database_corrupted: DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", page_not_corrupt: bpage = bpage; ); + if (err == DB_PAGE_CORRUPTED + || err == DB_DECRYPTION_FAILED) { + buf_corrupt_page_release(bpage, space); + + if (recv_recovery_is_on()) { + recv_recover_corrupt_page(bpage); + } + + space->release_for_io(); + return err; + } + if (recv_recovery_is_on()) { recv_recover_page(bpage); } diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc index b3114a4cb47..c00dd414aa6 100644 --- a/storage/innobase/buf/buf0lru.cc +++ b/storage/innobase/buf/buf0lru.cc @@ -2204,8 +2204,8 @@ buf_LRU_old_ratio_update_instance( buf_pool_t* buf_pool,/*!< in: buffer pool instance */ uint old_pct,/*!< in: Reserve this percentage of the buffer pool for "old" blocks. */ - ibool adjust) /*!< in: TRUE=adjust the LRU list; - FALSE=just assign buf_pool->LRU_old_ratio + bool adjust) /*!< in: true=adjust the LRU list; + false=just assign buf_pool->LRU_old_ratio during the initialization of InnoDB */ { uint ratio; @@ -2247,8 +2247,8 @@ buf_LRU_old_ratio_update( /*=====================*/ uint old_pct,/*!< in: Reserve this percentage of the buffer pool for "old" blocks. */ - ibool adjust) /*!< in: TRUE=adjust the LRU list; - FALSE=just assign buf_pool->LRU_old_ratio + bool adjust) /*!< in: true=adjust the LRU list; + false=just assign buf_pool->LRU_old_ratio during the initialization of InnoDB */ { uint new_ratio = 0; |