@@ -357,6 +357,7 @@ backup_data_file(const char *from_root, const char *to_root,
357357strerror (errno_tmp ));
358358}
359359
360+ fsync (fileno (out ));
360361fclose (in );
361362fclose (out );
362363
@@ -470,6 +471,7 @@ restore_file_partly(const char *from_root,const char *to_root, pgFile *file)
470471strerror (errno_tmp ));
471472}
472473
474+ fsync (fileno (out ));
473475fclose (in );
474476fclose (out );
475477}
@@ -605,6 +607,7 @@ restore_data_file(const char *from_root,
605607strerror (errno_tmp ));
606608}
607609
610+ fsync (fileno (out ));
608611fclose (in );
609612fclose (out );
610613}
@@ -732,6 +735,7 @@ copy_file(const char *from_root, const char *to_root, pgFile *file)
732735strerror (errno_tmp ));
733736}
734737
738+ fsync (fileno (out ));
735739fclose (in );
736740fclose (out );
737741
@@ -832,9 +836,9 @@ copy_wal_file(const char *from_path, const char *to_path)
832836strerror (errno_tmp ));
833837}
834838
839+ fsync (fileno (out ));
835840fclose (in );
836841fclose (out );
837-
838842}
839843
840844/*
@@ -957,6 +961,7 @@ copy_file_partly(const char *from_root, const char *to_root,
957961/* add meta information needed for recovery */
958962file -> is_partial_copy = true;
959963
964+ fsync (fileno (out ));
960965fclose (in );
961966fclose (out );
962967