Skip to content

Commit fcae2a6

Browse files
committed
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 c0f47a4 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.
1 parent 52e2762 commit fcae2a6

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

storage/innobase/buf/buf0buf.cc

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,14 +1068,8 @@ buf_page_is_corrupted(
10681068
size_t checksum_field2 = 0;
10691069
uint32_t crc32 = 0;
10701070
bool crc32_inited = false;
1071-
ulint zip_size = 0;
10721071
bool crc32_chksum = false;
1073-
1074-
zip_size = FSP_FLAGS_GET_ZIP_SSIZE(fsp_flags);
1075-
if (zip_size) {
1076-
zip_size = (UNIV_ZIP_SIZE_MIN >> 1) << zip_size;
1077-
}
1078-
1072+
const ulint zip_size = fil_space_t::zip_size(fsp_flags);
10791073
ulint page_type = mach_read_from_2(read_buf + FIL_PAGE_TYPE);
10801074

10811075
/* We can trust page type if page compression is set on tablespace

storage/innobase/fsp/fsp0file.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -699,15 +699,16 @@ Datafile::find_space_id()
699699

700700
/* For noncompressed pages, the page size must be
701701
equal to srv_page_size. */
702-
if (page_size == srv_page_size) {
702+
if (page_size == srv_page_size
703+
&& !fil_space_t::zip_size(fsp_flags)) {
703704
noncompressed_ok = !buf_page_is_corrupted(
704705
false, page, fsp_flags);
705706
}
706707

707708
bool compressed_ok = false;
708709

709710
if (srv_page_size <= UNIV_PAGE_SIZE_DEF
710-
&& page_size <= srv_page_size) {
711+
&& page_size == fil_space_t::zip_size(fsp_flags)) {
711712
compressed_ok = !buf_page_is_corrupted(
712713
false, page, fsp_flags);
713714
}

0 commit comments

Comments
 (0)