diff options
author | Simon Riggs <simon@2ndQuadrant.com> | 2012-08-07 16:21:49 +0100 |
---|---|---|
committer | Simon Riggs <simon@2ndQuadrant.com> | 2012-08-07 16:21:49 +0100 |
commit | efed8c0031dbae0adb4ed4cb6197acd57397d2e9 (patch) | |
tree | 816a506a0415e714ecc42b2b538397c5b980c73a | |
parent | 1c638c80747fa605c32193cdbd504a2cce6f0006 (diff) | |
download | postgresql-efed8c0031dbae0adb4ed4cb6197acd57397d2e9.tar.gz postgresql-efed8c0031dbae0adb4ed4cb6197acd57397d2e9.zip |
fsync backup_label after pg_start_backup()
Dave Kerr, backpatched by Simon Riggs
-rw-r--r-- | src/backend/access/transam/xlog.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 1612f44e4ec..adf5bc93de5 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -9093,7 +9093,8 @@ do_pg_start_backup(const char *backupidstr, bool fast, char **labelfile) errmsg("could not create file \"%s\": %m", BACKUP_LABEL_FILE))); fwrite(labelfbuf.data, labelfbuf.len, 1, fp); - 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", |