On Fri, Jan 28, 2022 at 12:36 PM Andres Freund <and...@anarazel.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).