]> granicus.if.org Git - postgresql/commitdiff
fsync backup_label after pg_start_backup()
authorSimon Riggs <simon@2ndQuadrant.com>
Wed, 8 Aug 2012 20:06:05 +0000 (21:06 +0100)
committerSimon Riggs <simon@2ndQuadrant.com>
Wed, 8 Aug 2012 20:06:05 +0000 (21:06 +0100)
Dave Kerr, backpatched by Simon Riggs

src/backend/access/transam/xlog.c

index b8df42567d265a8efd758ba04f724c1a9927a483..b8ca6857afb88a3fa6bd7c6b6c1e528907b5786c 100644 (file)
@@ -7429,7 +7429,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",