postgres.git / summary / log / commit / refs
commit c0751d323e96fcaaecba289b71970388972ee608
Author: Simon Riggs <simon@2ndQuadrant.com>
Date: Tue Aug 07 15:22:58 2012 +0000
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 0cab155fcfa..9a9b04f2422 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",
[parent: 8fb54e91b3b5]