From b4287ec3865d90920f0cc440c36f4873dcf51703 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Wed, 5 Jun 2019 16:36:51 +0530 Subject: [PATCH] MDEV-19541 InnoDB crashes when trying to recover a corrupted page - Use corrupt page id instead of whole block after releasing it from LRU list. --- storage/innobase/buf/buf0buf.cc | 4 +++- storage/innobase/include/log0recv.h | 4 ++-- storage/innobase/log/log0recv.cc | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 756caac1f54..18decb492f3 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -6051,10 +6051,12 @@ database_corrupted: if (err == DB_PAGE_CORRUPTED || err == DB_DECRYPTION_FAILED) { + const page_id_t corrupt_page_id = bpage->id; + buf_corrupt_page_release(bpage, space); if (recv_recovery_is_on()) { - recv_recover_corrupt_page(bpage); + recv_recover_corrupt_page(corrupt_page_id); } fil_space_release_for_io(space); diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h index 9bb54960058..03f6a6ff878 100644 --- a/storage/innobase/include/log0recv.h +++ b/storage/innobase/include/log0recv.h @@ -51,8 +51,8 @@ recv_find_max_checkpoint(ulint* max_field) /** Reduces recv_sys->n_addrs for the corrupted page. This function should called when srv_force_recovery > 0. -@param[in] bpage buffer pool page */ -void recv_recover_corrupt_page(buf_page_t* bpage); +@param[in] page_id page id of the corrupted page */ +void recv_recover_corrupt_page(page_id_t page_id); /** Apply any buffered redo log to a page that was just read from a data file. @param[in,out] bpage buffer pool page */ diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index c0521f1dba4..dbce6f90fc2 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -2214,8 +2214,8 @@ skip_log: /** Reduces recv_sys->n_addrs for the corrupted page. This function should called when srv_force_recovery > 0. -@param[in] bpage buffer pool page */ -void recv_recover_corrupt_page(buf_page_t* bpage) +@param[in] page_id page id of the corrupted page */ +void recv_recover_corrupt_page(page_id_t page_id) { ut_ad(srv_force_recovery); mutex_enter(&recv_sys->mutex); @@ -2226,7 +2226,7 @@ void recv_recover_corrupt_page(buf_page_t* bpage) } recv_addr_t* recv_addr = recv_get_fil_addr_struct( - bpage->id.space(), bpage->id.page_no()); + page_id.space(), page_id.page_no()); ut_ad(recv_addr->state != RECV_WILL_NOT_READ);