fsync backup_label after pg_start_backup()
authorSimon Riggs
Tue, 7 Aug 2012 15:22:58 +0000 (16:22 +0100)
committerSimon Riggs
Tue, 7 Aug 2012 15:22:58 +0000 (16:22 +0100)
Dave Kerr, backpatched by Simon Riggs

src/backend/access/transam/xlog.c

index 0cab155fcfa6fef083f2ec5e28dfff3de8270f24..9a9b04f242224c190d93be335e38ca8f5f5e5d3d 100644 (file)
@@ -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",