summaryrefslogtreecommitdiff
path: root/storage/innobase/buf/buf0buf.cc
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/buf/buf0buf.cc')
-rw-r--r--storage/innobase/buf/buf0buf.cc51
1 files changed, 40 insertions, 11 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);
}