Re: Does PostgreSQL use atomic file creation of FS? - Mailing list pgsql-general

From Dmitry Lazurkin
Subject Re: Does PostgreSQL use atomic file creation of FS?
Date
Msg-id eb710719-3a2a-522a-39c9-2ebcdc24bb1b@gmail.com
Whole thread Raw
In response to Re: Does PostgreSQL use atomic file creation of FS?  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
Responses Re: Does PostgreSQL use atomic file creation of FS?
List pgsql-general
Thank you. But I have read this. I said about network file system only
for example. I would like to known how PostgreSQL handles this specific
case (of course if someone knowns a answer):

fd = open(file, "w");
write(fd, data);
// crash and now I have empty file which isn't correct
fsync(fd);

PS. I think PostgreSQL doesn't have this problem.

On 12/12/18 15:37, Karsten Hilbert wrote:
> On Wed, Dec 12, 2018 at 02:48:12PM +0300, Dmitry Lazurkin wrote:
>
>> Does PostgreSQL use atomic file creation on FS? How does PostgreSQL
>> catch situation when system crashes between open call and write call? I
>> am interesting in this because I would like use PostgreSQL on network
>> file system.
> I doubt we can get more certainty than this:
>
>     https://www.postgresql.org/docs/devel/creating-cluster.html#CREATING-CLUSTER-NFS
>
> Best,
> Karsten





pgsql-general by date:

Previous
From: Moreno Andreo
Date:
Subject: Re: Debian : No echo after pg_dump | psql
Next
From: Moreno Andreo
Date:
Subject: REVOKE to an user that doesn't exist