mirror of
https://github.com/postgres/postgres.git
synced 2025-06-11 20:28:21 +03:00
fsync backup_label after pg_start_backup()
Dave Kerr, backpatched by Simon Riggs
This commit is contained in:
@ -9093,7 +9093,8 @@ do_pg_start_backup(const char *backupidstr, bool fast, char **labelfile)
|
|||||||
errmsg("could not create file \"%s\": %m",
|
errmsg("could not create file \"%s\": %m",
|
||||||
BACKUP_LABEL_FILE)));
|
BACKUP_LABEL_FILE)));
|
||||||
fwrite(labelfbuf.data, labelfbuf.len, 1, fp);
|
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,
|
ereport(ERROR,
|
||||||
(errcode_for_file_access(),
|
(errcode_for_file_access(),
|
||||||
errmsg("could not write file \"%s\": %m",
|
errmsg("could not write file \"%s\": %m",
|
||||||
|
Reference in New Issue
Block a user