@@ -2545,49 +2545,55 @@ fil_space_verify_crypt_checksum(const byte* page, const page_size_t& page_size)
2545
2545
2546
2546
/* If stored checksum matches one of the calculated checksums
2547
2547
page is not corrupted. */
2548
- srv_checksum_algorithm_t algorithm = srv_checksum_algorithm_t (
2549
- srv_checksum_algorithm);
2550
2548
2551
- switch (algorithm ) {
2549
+ switch (srv_checksum_algorithm_t (srv_checksum_algorithm) ) {
2552
2550
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
2553
2551
if (page_size.is_compressed ()) {
2554
2552
return checksum == page_zip_calc_checksum (
2555
2553
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
+ ;
2557
2561
}
2558
2562
2559
2563
return checksum == buf_calc_page_crc32 (page)
2560
2564
#ifdef INNODB_BUG_ENDIAN_CRC32
2561
2565
|| checksum == buf_calc_page_crc32 (page, true )
2562
2566
#endif
2563
2567
;
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);
2571
2568
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". */
2573
2573
case SRV_CHECKSUM_ALGORITHM_NONE:
2574
2574
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". */
2575
2580
case SRV_CHECKSUM_ALGORITHM_INNODB:
2576
2581
case SRV_CHECKSUM_ALGORITHM_CRC32:
2577
2582
if (checksum == BUF_NO_CHECKSUM_MAGIC) {
2578
2583
return true ;
2579
2584
}
2580
2585
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;
2589
2586
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);
2591
2597
}
2592
2598
2593
2599
return checksum == buf_calc_page_crc32 (page)
0 commit comments