| From: | Michael Paquier <michael(at)paquier(dot)xyz> |
|---|---|
| To: | Arthur Zakirov <zaartur(at)gmail(dot)com> |
| Cc: | Julien Rouhaud <rjuju123(at)gmail(dot)com>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Add pg_file_sync() to adminpack |
| Date: | 2020-01-06 06:42:39 |
| Message-ID: | 20200106064239.GR3598@paquier.xyz |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Mon, Jan 06, 2020 at 03:20:13PM +0900, Arthur Zakirov wrote:
> It isn't case if a file doesn't exist. But if there are no permissions on
> the file:
>
> PANIC: could not open file "testfile": Permissions denied
> server closed the connection unexpectedly
>
> It could be fixed by implementing a function like pg_file_sync_internal() or
> by making the function fsync_fname_ext() external.
The patch uses stat() to make sure that the file exists and has no
issues. Though it could be a problem with any kind of TOCTOU-like
issues (looking at you, Windows, for ENOPERM), so I agree that it
would make more sense to use pg_fsync() here with a fd opened first.
--
Michael
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Gavin Flower | 2020-01-06 07:26:39 | Re: color by default |
| Previous Message | Michael Paquier | 2020-01-06 06:31:59 | Re: remove some STATUS_* symbols |