Browse Source

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 0b47c126e3
(MDEV-13542).
bb-10.6-MDEV-27317-galera
Marko Mäkelä 3 years ago
parent
commit
9c15799462
  1. 6
      storage/innobase/buf/buf0buf.cc
  2. 3
      storage/innobase/buf/buf0rea.cc
  3. 3
      storage/innobase/include/buf0buf.h

6
storage/innobase/buf/buf0buf.cc

@ -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()};

3
storage/innobase/buf/buf0rea.cc

@ -331,6 +331,9 @@ nothing_read:
/* 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;

3
storage/innobase/include/buf0buf.h

@ -773,7 +773,8 @@ public:
@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

Loading…
Cancel
Save