From c0751d323e96fcaaecba289b71970388972ee608 Mon Sep 17 00:00:00 2001 From: Simon Riggs Date: Tue, 7 Aug 2012 16:22:58 +0100 Subject: [PATCH] fsync backup_label after pg_start_backup() Dave Kerr, backpatched by Simon Riggs --- src/backend/access/transam/xlog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 0cab155fcf..9a9b04f242 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -8546,7 +8546,7 @@ pg_start_backup(PG_FUNCTION_ARGS) checkpointloc.xlogid, checkpointloc.xrecoff); fprintf(fp, "START TIME: %s\n", strfbuf); fprintf(fp, "LABEL: %s\n", backupidstr); - if (fflush(fp) || ferror(fp) || FreeFile(fp)) + if (fflush(fp) || ferror(fp) || pg_fsync(fileno(fp)) != 0 || FreeFile(fp)) ereport(ERROR, (errcode_for_file_access(), errmsg("could not write file \"%s\": %m",