@@ -596,8 +596,14 @@ do_backup_instance(PGconn *backup_conn, PGNodeInfo *nodeInfo, bool no_sync, bool
596596 }
597597
598598 /* 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+ }
601607
602608 /* close ssh session in main thread */
603609 fio_disconnect ();
@@ -693,25 +699,8 @@ do_backup_instance(PGconn *backup_conn, PGNodeInfo *nodeInfo, bool no_sync, bool
693699
694700 if (fio_sync (to_fullpath , FIO_BACKUP_HOST ) != 0 )
695701 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- }
710702 }
711703
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-
715704 time (& end_time );
716705 pretty_time_interval (difftime (end_time , start_time ),
717706 pretty_time , lengthof (pretty_time ));
0 commit comments