diff options
author | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2019-07-10 17:18:56 +0530 |
---|---|---|
committer | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2019-07-10 17:18:56 +0530 |
commit | e5539d6b1c87128d1c6c26045a76d09b7104df40 (patch) | |
tree | c2ba817b4f344832d3656ffbe7c95c77429a5c25 | |
parent | d91dd2878acdc18cda0460354341617b31f0282a (diff) | |
download | mariadb-git-bb-10.1-MDEV-19978.tar.gz |
MDEV-19978 Page read from tablespace is corruptedbb-10.1-MDEV-19978
Problem:
=======
Checksum fields can have value as zero. In that case, InnoDB falsely
consider that page should be all zeroes. It leads to wrong detection of page
corruption.
Solution:
========
Remove the condition that checks if checksum fields are zero then
page should be all zeroes.
-rw-r--r-- | storage/innobase/buf/buf0buf.cc | 29 | ||||
-rw-r--r-- | storage/xtradb/buf/buf0buf.cc | 26 |
2 files changed, 27 insertions, 28 deletions
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 50a3c8b8b2d..412b24f0249 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -951,26 +951,25 @@ buf_page_is_corrupted( the first page of each file of the system tablespace. Ignore it for the system tablespace. */ if (!checksum_field1 && !checksum_field2) { + /* Checksum fields can have valid value as zero. + If the page is not empty then do the checksum + calculation for the page. */ ulint i = 0; do { - if (read_buf[i]) { - return true; - } - } while (++i < FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION); - #ifndef UNIV_INNOCHECKSUM - if (!space || !space->id) { - /* Skip FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION - in the system tablespace. */ - i += 8; - } + if (i == FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + && (!space || !space->id)) { + i += 8; + } #endif - do { - if (read_buf[i]) { - return true; + if (read_buf[i++]) { + break; } - } while (++i < srv_page_size); - return false; + } while (i < srv_page_size); + + if (i == srv_page_size) { + return false; + } } switch (curr_algo) { diff --git a/storage/xtradb/buf/buf0buf.cc b/storage/xtradb/buf/buf0buf.cc index 80fe62decc3..b2c78fdf411 100644 --- a/storage/xtradb/buf/buf0buf.cc +++ b/storage/xtradb/buf/buf0buf.cc @@ -950,24 +950,24 @@ buf_page_is_corrupted( the first page of each file of the system tablespace. Ignore it for the system tablespace. */ if (!checksum_field1 && !checksum_field2) { + /* Checksum fields can have valid value as zero. + If the page is not empty then do the checksum + calculation for the page. */ ulint i = 0; do { - if (read_buf[i]) { - return true; + if (i == FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + && (!space || space->id)) { + i += 8; } - } while (++i < FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION); - if (!space || !space->id) { - /* Skip FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION - in the system tablespace. */ - i += 8; - } - do { - if (read_buf[i]) { - return true; + if (read_buf[i++]) { + break; } - } while (++i < srv_page_size); - return false; + } while (i < srv_page_size); + + if (i == srv_page_size) { + return false; + } } switch (curr_algo) { |