Skip to content

Commit 75e7e0b

Browse files
committed
Merge 10.2 into 10.3
2 parents af97310 + 0032170 commit 75e7e0b

File tree

1 file changed

+27
-21
lines changed

1 file changed

+27
-21
lines changed

storage/innobase/fil/fil0crypt.cc

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2545,49 +2545,55 @@ fil_space_verify_crypt_checksum(const byte* page, const page_size_t& page_size)
25452545

25462546
/* If stored checksum matches one of the calculated checksums
25472547
page is not corrupted. */
2548-
srv_checksum_algorithm_t algorithm = srv_checksum_algorithm_t(
2549-
srv_checksum_algorithm);
25502548

2551-
switch (algorithm) {
2549+
switch (srv_checksum_algorithm_t(srv_checksum_algorithm)) {
25522550
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
25532551
if (page_size.is_compressed()) {
25542552
return checksum == page_zip_calc_checksum(
25552553
page, page_size.physical(),
2556-
SRV_CHECKSUM_ALGORITHM_CRC32);
2554+
SRV_CHECKSUM_ALGORITHM_CRC32)
2555+
#ifdef INNODB_BUG_ENDIAN_CRC32
2556+
|| checksum == page_zip_calc_checksum(
2557+
page, page_size.physical(),
2558+
SRV_CHECKSUM_ALGORITHM_CRC32, true)
2559+
#endif
2560+
;
25572561
}
25582562

25592563
return checksum == buf_calc_page_crc32(page)
25602564
#ifdef INNODB_BUG_ENDIAN_CRC32
25612565
|| checksum == buf_calc_page_crc32(page, true)
25622566
#endif
25632567
;
2564-
case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
2565-
if (page_size.is_compressed()) {
2566-
return checksum == page_zip_calc_checksum(
2567-
page, page_size.physical(),
2568-
SRV_CHECKSUM_ALGORITHM_INNODB);
2569-
}
2570-
return checksum == buf_calc_page_new_checksum(page);
25712568
case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
2572-
return checksum == BUF_NO_CHECKSUM_MAGIC;
2569+
/* Starting with MariaDB 10.1.25, 10.2.7, 10.3.1,
2570+
due to MDEV-12114, fil_crypt_calculate_checksum()
2571+
is only using CRC32 for the encrypted pages.
2572+
Due to this, we must treat "strict_none" as "none". */
25732573
case SRV_CHECKSUM_ALGORITHM_NONE:
25742574
return true;
2575+
case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
2576+
/* Starting with MariaDB 10.1.25, 10.2.7, 10.3.1,
2577+
due to MDEV-12114, fil_crypt_calculate_checksum()
2578+
is only using CRC32 for the encrypted pages.
2579+
Due to this, we must treat "strict_innodb" as "innodb". */
25752580
case SRV_CHECKSUM_ALGORITHM_INNODB:
25762581
case SRV_CHECKSUM_ALGORITHM_CRC32:
25772582
if (checksum == BUF_NO_CHECKSUM_MAGIC) {
25782583
return true;
25792584
}
25802585
if (page_size.is_compressed()) {
2581-
if (checksum == page_zip_calc_checksum(
2582-
page, page_size.physical(), algorithm)) {
2583-
return true;
2584-
}
2585-
2586-
algorithm = algorithm == SRV_CHECKSUM_ALGORITHM_INNODB
2587-
? SRV_CHECKSUM_ALGORITHM_CRC32
2588-
: SRV_CHECKSUM_ALGORITHM_INNODB;
25892586
return checksum == page_zip_calc_checksum(
2590-
page, page_size.physical(), algorithm);
2587+
page, page_size.physical(),
2588+
SRV_CHECKSUM_ALGORITHM_CRC32)
2589+
#ifdef INNODB_BUG_ENDIAN_CRC32
2590+
|| checksum == page_zip_calc_checksum(
2591+
page, page_size.physical(),
2592+
SRV_CHECKSUM_ALGORITHM_CRC32, true)
2593+
#endif
2594+
|| checksum == page_zip_calc_checksum(
2595+
page, page_size.physical(),
2596+
SRV_CHECKSUM_ALGORITHM_INNODB);
25912597
}
25922598

25932599
return checksum == buf_calc_page_crc32(page)

0 commit comments

Comments
 (0)