Re: fdatasync(2) on macOS

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: fdatasync(2) on macOS
Date: 2021-02-04 21:48:26
Message-ID: CA+hUKGLn-FtpFna3xLVzFohRWhFGV+VOK+AQbU6=by1fiXHUqA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jan 18, 2021 at 4:39 PM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
> On Sat, Jan 16, 2021 at 6:55 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > So it's not a no-op, but on the other hand it's not succeeding in getting
> > bits down to the platter. I'm not inclined to dike it out, but it does
> > seem problematic that we're defaulting to open_datasync, which is also
> > not getting bits down to the platter.
>
> Hmm, OK, from these times it does appear that O_SYNC and O_DSYNC
> actually do something then. It's baffling that they are undocumented.

I was digging through Apple sources again trying to learn something
about bug report #16827, and I spotted one extra detail that I wanted
to share in this thread about these undocumented system interfaces,
just for the record. It appears that as of macOS 11.2/XNU 7195.83.3,
their vn_write() doesn't treat O_DSYNC any differently than O_SYNC:

/*
* Treat synchronous mounts and O_FSYNC on the fd as equivalent.
*
* XXX We treat O_DSYNC as O_FSYNC for now, since we can not delay
* XXX the non-essential metadata without some additional VFS work;
* XXX the intent at this point is to plumb the interface for it.
*/
if ((fp->fp_glob->fg_flag & (O_FSYNC | O_DSYNC)) ||
(vp->v_mount && (vp->v_mount->mnt_flag & MNT_SYNCHRONOUS))) {
ioflag |= IO_SYNC;
}

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2021-02-04 21:48:35 Re: [POC] verifying UTF-8 using SIMD instructions
Previous Message Robert Haas 2021-02-04 21:04:10 Re: new heapcheck contrib module