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.