@@ -487,7 +487,7 @@ compress_and_backup_page(pgFile *file, BlockNumber blknum,
487487 blknum, header.compressed_size, write_buffer_size); */
488488
489489 /* Update CRC */
490- COMP_TRADITIONAL_CRC32 ( * crc , write_buffer , write_buffer_size );
490+ COMP_FILE_CRC32 (true, * crc , write_buffer , write_buffer_size );
491491
492492 /* write data page */
493493 if (fwrite (write_buffer , 1 , write_buffer_size , out ) != write_buffer_size )
@@ -547,13 +547,13 @@ backup_data_file(backup_files_arg* arguments,
547547 /* reset size summary */
548548 file -> read_size = 0 ;
549549 file -> write_size = 0 ;
550- INIT_TRADITIONAL_CRC32 ( file -> crc );
550+ INIT_FILE_CRC32 (true, file -> crc );
551551
552552 /* open backup mode file for read */
553553 in = fopen (file -> path , PG_BINARY_R );
554554 if (in == NULL )
555555 {
556- FIN_TRADITIONAL_CRC32 ( file -> crc );
556+ FIN_FILE_CRC32 (true, file -> crc );
557557
558558 /*
559559 * If file is not found, this is not en error.
@@ -658,7 +658,7 @@ backup_data_file(backup_files_arg* arguments,
658658 to_path , strerror (errno ));
659659 fclose (in );
660660
661- FIN_TRADITIONAL_CRC32 ( file -> crc );
661+ FIN_FILE_CRC32 (true, file -> crc );
662662
663663 /*
664664 * If we have pagemap then file in the backup can't be a zero size.
@@ -927,7 +927,7 @@ copy_file(const char *from_root, const char *to_root, pgFile *file)
927927 struct stat st ;
928928 pg_crc32 crc ;
929929
930- INIT_TRADITIONAL_CRC32 ( crc );
930+ INIT_FILE_CRC32 (true, crc );
931931
932932 /* reset size summary */
933933 file -> read_size = 0 ;
@@ -937,7 +937,7 @@ copy_file(const char *from_root, const char *to_root, pgFile *file)
937937 in = fopen (file -> path , PG_BINARY_R );
938938 if (in == NULL )
939939 {
940- FIN_TRADITIONAL_CRC32 ( crc );
940+ FIN_FILE_CRC32 (true, crc );
941941 file -> crc = crc ;
942942
943943 /* maybe deleted, it's not error */
@@ -986,7 +986,7 @@ copy_file(const char *from_root, const char *to_root, pgFile *file)
986986 strerror (errno_tmp ));
987987 }
988988 /* update CRC */
989- COMP_TRADITIONAL_CRC32 ( crc , buf , read_len );
989+ COMP_FILE_CRC32 (true, crc , buf , read_len );
990990
991991 file -> read_size += read_len ;
992992 }
@@ -1013,14 +1013,14 @@ copy_file(const char *from_root, const char *to_root, pgFile *file)
10131013 strerror (errno_tmp ));
10141014 }
10151015 /* update CRC */
1016- COMP_TRADITIONAL_CRC32 ( crc , buf , read_len );
1016+ COMP_FILE_CRC32 (true, crc , buf , read_len );
10171017
10181018 file -> read_size += read_len ;
10191019 }
10201020
10211021 file -> write_size = (int64 ) file -> read_size ;
10221022 /* finish CRC calculation and store into pgFile */
1023- FIN_TRADITIONAL_CRC32 ( crc );
1023+ FIN_FILE_CRC32 (true, crc );
10241024 file -> crc = crc ;
10251025
10261026 /* update file permission */
@@ -1424,7 +1424,7 @@ calc_file_checksum(pgFile *file)
14241424{
14251425 Assert (S_ISREG (file -> mode ));
14261426
1427- file -> crc = pgFileGetCRC (file -> path , false , false, & file -> read_size );
1427+ file -> crc = pgFileGetCRC (file -> path , true , false, & file -> read_size );
14281428 file -> write_size = file -> read_size ;
14291429}
14301430
@@ -1547,14 +1547,14 @@ validate_one_page(Page page, pgFile *file,
15471547
15481548/* Valiate pages of datafile in backup one by one */
15491549bool
1550- check_file_pages (pgFile * file , XLogRecPtr stop_lsn ,
1551- uint32 checksum_version , uint32 backup_version )
1550+ check_file_pages (pgFile * file , XLogRecPtr stop_lsn , uint32 checksum_version ,
1551+ uint32 backup_version )
15521552{
15531553 size_t read_len = 0 ;
15541554 bool is_valid = true;
15551555 FILE * in ;
15561556 pg_crc32 crc ;
1557- bool use_crc32c = ( backup_version <= 20021 ) ;
1557+ bool use_crc32c = backup_version <= 20021 || backup_version >= 20025 ;
15581558
15591559 elog (VERBOSE , "validate relation blocks for file %s" , file -> name );
15601560
0 commit comments