Re: Loaded footgun open_datasync on Windows - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: Loaded footgun open_datasync on Windows
Date
Msg-id CAA4eK1LmCYBLzjnUctkxm4pwJ-v9NiSJSF3SivW78=ytiSx-zA@mail.gmail.com
Whole thread Raw
In response to Loaded footgun open_datasync on Windows  (Laurenz Albe <laurenz.albe@cybertec.at>)
Responses Re: Loaded footgun open_datasync on Windows
Re: Loaded footgun open_datasync on Windows
List pgsql-hackers
On Fri, Jun 1, 2018 at 3:13 PM, Laurenz Albe <laurenz.albe@cybertec.at> wrote:
I recently read our documentation about reliability on Windows:

> On Windows, if wal_sync_method is open_datasync (the default), write caching can
> be disabled by unchecking
> My Computer\Open\disk drive\Properties\Hardware\Properties\Policies\Enable write caching
> on the disk. Alternatively, set wal_sync_method to fsync or fsync_writethrough,
> which prevent write caching.

It seems dangerous to me to initialize "wal_sync_method" to a method that is unsafe
by default.  Admittedly I am not a Windows man, but the fact that this has eluded me
up to now leads me to believe that other people running PostgreSQL on Windows might
also have missed that important piece of advice and are consequently running with
an unsafe setup.

Wouldn't it be smarter to set a different default value on Windows, like we do on
Linux (for other reasons)?


One thing to note is that it seems that in code we use FILE_FLAG_WRITE_THROUGH for open_datasync which according to MSDN [1] will bypass any intermediate cache .  See pgwin32_open.  Have you experimented to set any other option as we have a comment in code which say Win32 only has O_DSYNC?


-- 
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

pgsql-hackers by date:

Previous
From: James Coleman
Date:
Subject: Re: FW: Possible optimisation: push down SORT and LIMIT nodes
Next
From: Dmitry Dolgov
Date:
Subject: Re: why partition pruning doesn't work?