Commit fcae2a63 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-20383 Use of uninitialized value in Datafile::find_space_id() for ROW_FORMAT=COMPRESSED

Datafile::find_space_id(): Fix a regression that was introduced
in c0f47a4a for MDEV-12026.
Because the function buf_page_is_corrupted() now determines
the physical page size from the fsp_flags, our buffer size must
agree with the fsp_flags.

buf_page_is_corrupted(): Use the correct accessor
fil_space_t::zip_size() for convering the tablespace flags.
ROW_FORMAT=COMPRESSED files never use innodb_checksum_algorithm=full_crc32.
parent 52e27624
......@@ -1068,14 +1068,8 @@ buf_page_is_corrupted(
size_t checksum_field2 = 0;
uint32_t crc32 = 0;
bool crc32_inited = false;
ulint zip_size = 0;
bool crc32_chksum = false;
zip_size = FSP_FLAGS_GET_ZIP_SSIZE(fsp_flags);
if (zip_size) {
zip_size = (UNIV_ZIP_SIZE_MIN >> 1) << zip_size;
}
const ulint zip_size = fil_space_t::zip_size(fsp_flags);
ulint page_type = mach_read_from_2(read_buf + FIL_PAGE_TYPE);
/* We can trust page type if page compression is set on tablespace
......
......@@ -699,7 +699,8 @@ Datafile::find_space_id()
/* For noncompressed pages, the page size must be
equal to srv_page_size. */
if (page_size == srv_page_size) {
if (page_size == srv_page_size
&& !fil_space_t::zip_size(fsp_flags)) {
noncompressed_ok = !buf_page_is_corrupted(
false, page, fsp_flags);
}
......@@ -707,7 +708,7 @@ Datafile::find_space_id()
bool compressed_ok = false;
if (srv_page_size <= UNIV_PAGE_SIZE_DEF
&& page_size <= srv_page_size) {
&& page_size == fil_space_t::zip_size(fsp_flags)) {
compressed_ok = !buf_page_is_corrupted(
false, page, fsp_flags);
}
......
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