MDEV-19978 Page read from tablespace is corrupted

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.
parent e52fea3f
...@@ -951,27 +951,27 @@ buf_page_is_corrupted( ...@@ -951,27 +951,27 @@ buf_page_is_corrupted(
the first page of each file of the system tablespace. the first page of each file of the system tablespace.
Ignore it for the system tablespace. */ Ignore it for the system tablespace. */
if (!checksum_field1 && !checksum_field2) { if (!checksum_field1 && !checksum_field2) {
ulint i = 0; /* Checksum fields can have valid value as zero.
do { If the page is not empty then do the checksum
if (read_buf[i]) { calculation for the page. */
return true; bool all_zeroes = true;
} for (size_t i = 0; i < srv_page_size; i++) {
} while (++i < FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
#ifndef UNIV_INNOCHECKSUM #ifndef UNIV_INNOCHECKSUM
if (!space || !space->id) { if (i == FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
/* Skip FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION && (!space || !space->id)) {
in the system tablespace. */
i += 8; i += 8;
} }
#endif #endif
do {
if (read_buf[i]) { if (read_buf[i]) {
return true; all_zeroes = false;
break;
}
} }
} while (++i < srv_page_size);
if (all_zeroes) {
return false; return false;
} }
}
switch (curr_algo) { switch (curr_algo) {
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32: case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
......
...@@ -950,25 +950,26 @@ buf_page_is_corrupted( ...@@ -950,25 +950,26 @@ buf_page_is_corrupted(
the first page of each file of the system tablespace. the first page of each file of the system tablespace.
Ignore it for the system tablespace. */ Ignore it for the system tablespace. */
if (!checksum_field1 && !checksum_field2) { if (!checksum_field1 && !checksum_field2) {
ulint i = 0; /* Checksum fields can have valid value as zero.
do { If the page is not empty then do the checksum
if (read_buf[i]) { calculation for the page. */
return true; bool all_zeroes = true;
} for (size_t i = 0; i < srv_page_size; i++) {
} while (++i < FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION); if (i == FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
&& (!space || space->id)) {
if (!space || !space->id) {
/* Skip FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
in the system tablespace. */
i += 8; i += 8;
} }
do {
if (read_buf[i]) { if (read_buf[i]) {
return true; all_zeroes = false;
break;
}
} }
} while (++i < srv_page_size);
if (all_zeroes) {
return false; return false;
} }
}
switch (curr_algo) { switch (curr_algo) {
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32: case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
......
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