Commit 9c157994 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-30397: MariaDB crash due to DB_FAIL reported for a corrupted page

buf_read_page_low(): Map the buf_page_t::read_complete() return
value DB_FAIL to DB_PAGE_CORRUPTED. The purpose of the DB_FAIL
return value is to avoid error log noise when read-ahead brings
in an unused page that is typically filled with NUL bytes.

If a synchronous read is bringing in a corrupted page where the
page frame does not contain the expected tablespace identifier and
page number, that must be treated as an attempt to read a corrupted
page. The correct error code for this is DB_PAGE_CORRUPTED.
The error code DB_FAIL is not handled by row_mysql_handle_errors().

This was missed in commit 0b47c126
(MDEV-13542).
parent cc27e5fd
......@@ -3449,8 +3449,7 @@ or decrypt/decompress just failed.
@retval DB_SUCCESS if page has been read and is not corrupted
@retval DB_PAGE_CORRUPTED if page based on checksum check is corrupted
@retval DB_DECRYPTION_FAILED if page post encryption checksum matches but
after decryption normal page checksum does not match.
@retval DB_TABLESPACE_DELETED if accessed tablespace is not found */
after decryption normal page checksum does not match. */
static dberr_t buf_page_check_corrupt(buf_page_t *bpage,
const fil_node_t &node)
{
......@@ -3507,7 +3506,8 @@ static dberr_t buf_page_check_corrupt(buf_page_t *bpage,
@param node data file
@return whether the operation succeeded
@retval DB_PAGE_CORRUPTED if the checksum fails
@retval DB_DECRYPTION_FAILED if the page cannot be decrypted */
@retval DB_DECRYPTION_FAILED if the page cannot be decrypted
@retval DB_FAIL if the page contains the wrong ID */
dberr_t buf_page_t::read_complete(const fil_node_t &node)
{
const page_id_t expected_id{id()};
......
......@@ -331,6 +331,9 @@ buf_read_page_low(
/* The i/o was already completed in space->io() */
*err = bpage->read_complete(*fio.node);
space->release();
if (*err == DB_FAIL) {
*err = DB_PAGE_CORRUPTED;
}
}
return true;
......
......@@ -773,7 +773,8 @@ class buf_page_t
@param node data file
@return whether the operation succeeded
@retval DB_PAGE_CORRUPTED if the checksum fails
@retval DB_DECRYPTION_FAILED if the page cannot be decrypted */
@retval DB_DECRYPTION_FAILED if the page cannot be decrypted
@retval DB_FAIL if the page contains the wrong ID */
dberr_t read_complete(const fil_node_t &node);
/** Note that a block is no longer dirty, while not removing
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment