public inbox for [email protected]  
help / color / mirror / Atom feed
From: Nathan Bossart <[email protected]>
To: Peter Eisentraut <[email protected]>
Cc: Jelte Fennema-Nio <[email protected]>
Cc: Thomas Munro <[email protected]>
Cc: pgsql-hackers <[email protected]>
Subject: Re: Volatile write caches on macOS and Windows, redux
Date: Mon, 3 Jun 2024 10:28:15 -0500
Message-ID: <Zl3hD7iS9Ho9xWMI@nathan> (raw)
In-Reply-To: <[email protected]>
References: <CA+hUKG+F0EL4Up6yVYbbcWse4xKaqW4wc2xpw67Pq9FjmByWVg@mail.gmail.com>
	<CAGECzQTyUztx0UtwsRh=z4fTMGxgGd5Zo5++kYbCg5FtHE59ew@mail.gmail.com>
	<[email protected]>

On Wed, May 29, 2024 at 06:49:57AM -0700, Peter Eisentraut wrote:
> On 25.05.24 04:01, Jelte Fennema-Nio wrote:
>> Is this the only reason why you're suggesting adding fsync=full,
>> instead of simply always setting F_FULLFSYNC when fsync=true on MacOS.
>> If so, I'm not sure we really gain anything by this tri-state. I think
>> people either care about data loss on power loss, or they don't. I
>> doubt many people want his third intermediate option, which afaict
>> basically means lose data on powerloss less often than fsync=false but
>> still lose data most of the time.
> 
> I agree, two states should be enough.  It could basically just be
> 
> pg_fsync(int fd)
> {
> #if macos
>     fcntl(fd, F_FULLFSYNC);
> #else
>     fsync(fd);
> #endif
> }

IIUC with this approach, anyone who is using a file system that fails
fcntl(F_FULLSYNC) with ENOSUPP would have to turn fsync off.  That might be
the right thing to do since having a third option that sends the data to
the disk cache but doesn't provide any real guarantees if you lose power
may not be worth much.  However, if such a file system _did_ provide such
guarantees with just fsync(), then it would be unfortunate to force people
to turn fsync off.  But this could very well all be hypothetical, for all I
know...  In any case, I agree that we should probably use F_FULLFSYNC by
default on macOS.

-- 
nathan






view thread (5+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Volatile write caches on macOS and Windows, redux
  In-Reply-To: <Zl3hD7iS9Ho9xWMI@nathan>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox