fsync backup_label after pg_start_backup()
authorSimon Riggs <[email protected]>
Wed, 8 Aug 2012 20:07:35 +0000 (21:07 +0100)
committerSimon Riggs <[email protected]>
Wed, 8 Aug 2012 20:07:35 +0000 (21:07 +0100)
Dave Kerr, backpatched by Simon Riggs

src/backend/access/transam/xlog.c

index 47d11b945bd7043c1fc83d4392b98f6e15749908..88f2b3944390bcb5d853f8f1aa58d0866d88464a 100644 (file)
@@ -6634,7 +6634,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",