@@ -493,45 +493,47 @@ writePtrackMap(const char *ptrackMap, const size_t ptrackmap_size,
493493/*
494494* Copy ptrack.map file to backup. We do apply compression to this file.
495495*/
496- void
497- copy_ptrackmap_file (const char * from_fullpath ,fio_location from_location ,
498- const char * to_fullpath ,fio_location to_location ,pgFile * file )
499- {
496+ void copy_ptrackmap_file (const char * from_fullpath ,fio_location from_location ,
497+ const char * to_fullpath ,fio_location to_location ,
498+ pgFile * file ) {
500499char * buffer ;
501500size_t size ;
502501
502+ bool missing_ok = true;
503+ bool use_crc32c = true;
504+
503505const char * errormsg = NULL ;
504506
505507buffer = slurpFile (from_fullpath ,"" ,& size , false,from_location );
506508
507509size_t compressed_size = size ;
508- void * compressed = pg_malloc (compressed_size );
509-
510- int rc = do_compress (compressed ,compressed_size ,buffer ,size ,current .compress_alg ,current .compress_level ,& errormsg );
510+ void * compressed = pg_malloc (compressed_size );
511511
512- /* Something went wrong and errormsg was assigned, throw a warning */
513- if (rc < 0 && errormsg != NULL )
514- elog (WARNING ,"An error occured during compressing ptrack.map: %s" ,errormsg );
512+ int rc = do_compress (compressed ,compressed_size ,buffer ,size ,
513+ current .compress_alg ,current .compress_level ,& errormsg );
515514
516- /* compression didn`t worked */
517- if (rc <=0 || rc >=size )
518- {
519- /* Do not compress ptrack.map */
520- memcpy (compressed ,buffer ,size );
521- }
522- else {
523- compressed_size = rc ;
524- }
525-
526- // file->crc = Ptrack.crc; // how to make it?
527- file -> size = compressed_size ;
528- file -> read_size = size ;
529- file -> write_size = compressed_size ;
530- file -> uncompressed_size = size ;
531- file -> compress_alg = current .compress_alg ;
515+ /* Something went wrong and errormsg was assigned, throw a warning */
516+ if (rc < 0 && errormsg != NULL )
517+ elog (WARNING ,"An error occured during compressing ptrack.map: %s" ,
518+ errormsg );
519+
520+ /* compression didn`t worked */
521+ if (rc <=0 || rc >=size ) {
522+ /* Do not compress ptrack.map */
523+ memcpy (compressed ,buffer ,size );
524+ }else {
525+ compressed_size = rc ;
526+ }
532527
533528writePtrackMap (compressed ,compressed_size ,to_fullpath ,to_location );
534529
530+ file -> crc = pgFileGetCRCgz (to_fullpath ,use_crc32c ,missing_ok );;
531+ file -> size = compressed_size ;
532+ file -> read_size = size ;
533+ file -> write_size = compressed_size ;
534+ file -> uncompressed_size = size ;
535+ file -> compress_alg = current .compress_alg ;
536+
535537pg_free (compressed );
536538pg_free (buffer );
537539}