Re: Creation of an empty table is not fsync'd at checkpoint

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Creation of an empty table is not fsync'd at checkpoint
Date: 2022-01-28 01:48:58
Message-ID: CA+hUKGKtz8DEuc846FrhFU53HzrVWFMf_=z62b0==H=SmCANJA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 28, 2022 at 12:36 PM Andres Freund <andres(at)anarazel(dot)de> wrote:
> On 2022-01-28 00:39:22 +0200, Heikki Linnakangas wrote:
> > On 28/01/2022 00:11, Thomas Munro wrote:
> > > ... but we still never synchronize "base/5". According to our
> > > project's reading of the POSIX tea leaves we should be doing that to
> > > nail down the directory entry.
> >
> > Really? 'base/5' is fsync'd by initdb, when it's created. I didn't think we
> > try to fsync() the directory, when a new file is created in it.
>
> I've not heard of concrete reports of it being needed (whereas the directory
> fsync being needed after a rename() is pretty easy to be reproduce). There's
> some technical reasons why it'd make sense for it to only be really needed for
> things after the initial file creation, but I'm not sure it's a good idea to
> rely on it.

I don't personally know of any system where that would break either.
I base my paranoia on man pages and the Austin Group's famous open
ticket 0000672. Those don't mention special treatment for O_CREAT,
though I get the technical reason why it's different. I think we
should probably do something about that even if it's hypothetical, but
I'm happy to call it a separate topic and follow up later (like commit
aca74843 did for SLRUs).

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2022-01-28 02:00:46 Re: Is there a way (except from server logs) to know the kind of on-going/last checkpoint?
Previous Message Kyotaro Horiguchi 2022-01-28 01:41:28 Re: Is there a way (except from server logs) to know the kind of on-going/last checkpoint?