Re: Does PostgreSQL use atomic file creation of FS?

From: Dmitry Lazurkin <dilaz03(at)gmail(dot)com>
To: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Does PostgreSQL use atomic file creation of FS?
Date: 2018-12-12 12:52:03
Message-ID: eb710719-3a2a-522a-39c9-2ebcdc24bb1b@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Moreno Andreo 2018-12-12 13:11:21 REVOKE to an user that doesn't exist
Previous Message Moreno Andreo 2018-12-12 12:51:55 Re: Debian : No echo after pg_dump | psql