Skip to content

Commit 9c15799

Browse files
committed
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 0b47c12 (MDEV-13542).
1 parent cc27e5f commit 9c15799

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

storage/innobase/buf/buf0buf.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3449,8 +3449,7 @@ or decrypt/decompress just failed.
34493449
@retval DB_SUCCESS if page has been read and is not corrupted
34503450
@retval DB_PAGE_CORRUPTED if page based on checksum check is corrupted
34513451
@retval DB_DECRYPTION_FAILED if page post encryption checksum matches but
3452-
after decryption normal page checksum does not match.
3453-
@retval DB_TABLESPACE_DELETED if accessed tablespace is not found */
3452+
after decryption normal page checksum does not match. */
34543453
static dberr_t buf_page_check_corrupt(buf_page_t *bpage,
34553454
const fil_node_t &node)
34563455
{
@@ -3507,7 +3506,8 @@ static dberr_t buf_page_check_corrupt(buf_page_t *bpage,
35073506
@param node data file
35083507
@return whether the operation succeeded
35093508
@retval DB_PAGE_CORRUPTED if the checksum fails
3510-
@retval DB_DECRYPTION_FAILED if the page cannot be decrypted */
3509+
@retval DB_DECRYPTION_FAILED if the page cannot be decrypted
3510+
@retval DB_FAIL if the page contains the wrong ID */
35113511
dberr_t buf_page_t::read_complete(const fil_node_t &node)
35123512
{
35133513
const page_id_t expected_id{id()};

storage/innobase/buf/buf0rea.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,9 @@ buf_read_page_low(
331331
/* The i/o was already completed in space->io() */
332332
*err = bpage->read_complete(*fio.node);
333333
space->release();
334+
if (*err == DB_FAIL) {
335+
*err = DB_PAGE_CORRUPTED;
336+
}
334337
}
335338

336339
return true;

storage/innobase/include/buf0buf.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,8 @@ class buf_page_t
773773
@param node data file
774774
@return whether the operation succeeded
775775
@retval DB_PAGE_CORRUPTED if the checksum fails
776-
@retval DB_DECRYPTION_FAILED if the page cannot be decrypted */
776+
@retval DB_DECRYPTION_FAILED if the page cannot be decrypted
777+
@retval DB_FAIL if the page contains the wrong ID */
777778
dberr_t read_complete(const fil_node_t &node);
778779

779780
/** Note that a block is no longer dirty, while not removing

0 commit comments

Comments
 (0)