@@ -664,8 +664,8 @@ do_backup_instance(PGconn *backup_conn, PGNodeInfo *nodeInfo, bool no_sync, bool
664
664
665
665
for (i = 0 ; i < parray_num (backup_files_list ); i ++ )
666
666
{
667
- char to_fullpath [MAXPGPATH ];
668
- pgFile * file = (pgFile * ) parray_get (backup_files_list , i );
667
+ char to_fullpath [MAXPGPATH ];
668
+ pgFile * file = (pgFile * ) parray_get (backup_files_list , i );
669
669
670
670
/* TODO: sync directory ? */
671
671
if (S_ISDIR (file -> mode ))
@@ -687,7 +687,21 @@ do_backup_instance(PGconn *backup_conn, PGNodeInfo *nodeInfo, bool no_sync, bool
687
687
}
688
688
689
689
if (fio_sync (to_fullpath , FIO_BACKUP_HOST ) != 0 )
690
- elog (ERROR , "Failed to sync file \"%s\": %s" , to_fullpath , strerror (errno ));
690
+ elog (ERROR , "Cannot sync file \"%s\": %s" , to_fullpath , strerror (errno ));
691
+
692
+ /* fsync header file */
693
+ if (file -> external_dir_num == 0 &&
694
+ file -> is_datafile && !file -> is_cfs &&
695
+ file -> n_headers > 0 )
696
+ {
697
+ char to_fullpath_hdr [MAXPGPATH ];
698
+
699
+ snprintf (to_fullpath_hdr , MAXPGPATH , "%s_hdr" , to_fullpath );
700
+
701
+ if (fio_sync (to_fullpath , FIO_BACKUP_HOST ) != 0 )
702
+ elog (ERROR , "Cannot sync file \"%s\": %s" , to_fullpath_hdr , strerror (errno ));
703
+
704
+ }
691
705
}
692
706
693
707
time (& end_time );
@@ -2131,7 +2145,7 @@ backup_files(void *arg)
2131
2145
/* backup file */
2132
2146
if (file -> is_datafile && !file -> is_cfs )
2133
2147
{
2134
- backup_data_file (& (arguments -> conn_arg ), file , from_fullpath , to_fullpath ,
2148
+ backup_data_file_new (& (arguments -> conn_arg ), file , from_fullpath , to_fullpath ,
2135
2149
arguments -> prev_start_lsn ,
2136
2150
current .backup_mode ,
2137
2151
instance_config .compress_alg ,
@@ -2147,12 +2161,6 @@ backup_files(void *arg)
2147
2161
current .backup_mode , current .parent_backup , true);
2148
2162
}
2149
2163
2150
- /* No point in storing empty, missing or not changed files */
2151
- if (file -> write_size <= 0 )
2152
- unlink (to_fullpath );
2153
- // elog(ERROR, "Cannot remove file \"%s\": %s", to_fullpath,
2154
- // strerror(errno));
2155
-
2156
2164
if (file -> write_size == FILE_NOT_FOUND )
2157
2165
continue ;
2158
2166
0 commit comments