Skip to content

Commit efed8c0

Browse files
fsync backup_label after pg_start_backup()
Dave Kerr, backpatched by Simon Riggs
1 parent 1c638c8 commit efed8c0

File tree

1 file changed

+2
-1
lines changed
  • src/backend/access/transam

1 file changed

+2
-1
lines changed

src/backend/access/transam/xlog.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9093,7 +9093,8 @@ do_pg_start_backup(const char *backupidstr, bool fast, char **labelfile)
90939093
errmsg("could not create file \"%s\": %m",
90949094
BACKUP_LABEL_FILE)));
90959095
fwrite(labelfbuf.data, labelfbuf.len, 1, fp);
9096-
if (fflush(fp) || ferror(fp) || FreeFile(fp))
9096+
9097+
if (fflush(fp) || ferror(fp) || pg_fsync(fileno(fp)) != 0 || FreeFile(fp))
90979098
ereport(ERROR,
90989099
(errcode_for_file_access(),
90999100
errmsg("could not write file \"%s\": %m",

0 commit comments

Comments
 (0)