@@ -596,8 +596,14 @@ do_backup_instance(PGconn *backup_conn, PGNodeInfo *nodeInfo, bool no_sync, bool
596
596
}
597
597
598
598
/* close block header map */
599
- if (current .hdr_map .fp && fclose (current .hdr_map .fp ))
600
- elog (ERROR , "Cannot close file \"%s\"" , current .hdr_map .path );
599
+ if (current .hdr_map .fp )
600
+ {
601
+ if (fclose (current .hdr_map .fp ))
602
+ elog (ERROR , "Cannot close file \"%s\"" , current .hdr_map .path );
603
+
604
+ if (fio_sync (current .hdr_map .path , FIO_BACKUP_HOST ) != 0 )
605
+ elog (ERROR , "Cannot sync file \"%s\": %s" , current .hdr_map .path , strerror (errno ));
606
+ }
601
607
602
608
/* close ssh session in main thread */
603
609
fio_disconnect ();
@@ -693,25 +699,8 @@ do_backup_instance(PGconn *backup_conn, PGNodeInfo *nodeInfo, bool no_sync, bool
693
699
694
700
if (fio_sync (to_fullpath , FIO_BACKUP_HOST ) != 0 )
695
701
elog (ERROR , "Cannot sync file \"%s\": %s" , to_fullpath , strerror (errno ));
696
-
697
- /* fsync header file */
698
- if (file -> external_dir_num == 0 &&
699
- file -> is_datafile && !file -> is_cfs &&
700
- file -> n_headers > 0 )
701
- {
702
- char to_fullpath_hdr [MAXPGPATH ];
703
-
704
- snprintf (to_fullpath_hdr , MAXPGPATH , "%s_hdr" , to_fullpath );
705
-
706
- if (fio_sync (to_fullpath , FIO_BACKUP_HOST ) != 0 )
707
- elog (ERROR , "Cannot sync file \"%s\": %s" , to_fullpath_hdr , strerror (errno ));
708
-
709
- }
710
702
}
711
703
712
- if (fio_sync (current .hdr_map .path , FIO_BACKUP_HOST ) != 0 )
713
- elog (ERROR , "Cannot sync file \"%s\": %s" , current .hdr_map .path , strerror (errno ));
714
-
715
704
time (& end_time );
716
705
pretty_time_interval (difftime (end_time , start_time ),
717
706
pretty_time , lengthof (pretty_time ));
0 commit comments