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 c0f47a4a58 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.
This commit is contained in:
Marko Mäkelä 2019-08-19 16:29:36 +03:00
parent 52e276247d
commit fcae2a6364
2 changed files with 4 additions and 9 deletions

View file

@ -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

View file

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