Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 70ff5aa

Browse files
committed
fsync() backup_label, tablespace_map, recovery.conf
1 parent 3e8ac28 commit 70ff5aa

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/backup.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,6 +1112,7 @@ pg_stop_backup(pgBackup *backup)
11121112
backup_label, strerror(errno));
11131113

11141114
fwrite(PQgetvalue(res, 0, 1), 1, strlen(PQgetvalue(res, 0, 1)), fp);
1115+
fsync(fileno(fp));
11151116
fclose(fp);
11161117

11171118
/*
@@ -1139,6 +1140,7 @@ pg_stop_backup(pgBackup *backup)
11391140
tablespace_map, strerror(errno));
11401141

11411142
fwrite(PQgetvalue(res, 0, 2), 1, strlen(PQgetvalue(res, 0, 2)), fp);
1143+
fsync(fileno(fp));
11421144
fclose(fp);
11431145

11441146
file = pgFileNew(tablespace_map, true);
@@ -1662,6 +1664,7 @@ write_backup_file_list(parray *files, const char *root)
16621664

16631665
print_file_list(fp, files, root);
16641666

1667+
fsync(fileno(fp));
16651668
fclose(fp);
16661669
}
16671670

src/restore.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,7 @@ create_recovery_conf(time_t backup_id,
750750
if (target_tli)
751751
fprintf(fp, "recovery_target_timeline = '%u'\n", target_tli);
752752

753+
fsync(fileno(fp));
753754
fclose(fp);
754755
}
755756

0 commit comments

Comments
 (0)