Re: Volatile write caches on macOS and Windows, redux - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Volatile write caches on macOS and Windows, redux
Date
Msg-id 01b98671-1f23-447a-95e2-36a2b5a7bf05@eisentraut.org
Whole thread Raw
In response to Re: Volatile write caches on macOS and Windows, redux  (Nathan Bossart <nathandbossart@gmail.com>)
List pgsql-hackers
On 03.06.24 17:28, Nathan Bossart wrote:
>> 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.

Yeah, my example code above says "#if macos", not "#ifdef F_FULLSYNC". 
The latter might be a problem along the lines you describe if other 
systems use that symbol in a slightly different manner.




pgsql-hackers by date:

Previous
From: Peter Smith
Date:
Subject: Re: Synchronizing slots from primary to standby
Next
From: Peter Eisentraut
Date:
Subject: Re: Build with LTO / -flto on macOS