Incorrect fsync handling in pg_basebackup's tar_finish
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Postgres hackers <pgsql-hackers@postgresql.org>
Date: 2018-06-25T02:43:56Z
Lists: pgsql-hackers
Attachments
- walmethod-fsync.patch (text/x-diff) patch
Hi all,
I was just looking at the code of pg_basebackup, and noticed that we
don't actually check if the two last empty blocks of any tar file
produced are correctly fsync'd or not:
@@ -957,7 +957,10 @@ tar_finish(void)
/* sync the empty blocks as well, since they're after the last file */
if (tar_data->sync)
- fsync(tar_data->fd);
+ {
+ if (fsync(tar_data->fd) != 0)
+ return false;
+ }
That looks incorrect to me, hence shouldn't something like the attached
be done? Magnus and others, any opinions?
Thanks,
--
Michael
Commits
-
Correct handling of fsync failures with tar mode of walmethods.c
- 324076a62617 10.5 landed
- d08c3d5197fa 11.0 landed