fsync backup_label after pg_start_backup()

Dave Kerr, backpatched by Simon Riggs
This commit is contained in:
Simon Riggs 2012-08-08 21:07:35 +01:00
parent 8a88e57ee2
commit 074bef8207
1 changed files with 1 additions and 1 deletions

View 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",