Re: Final(?) proposal for wal_sync_method changes - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Final(?) proposal for wal_sync_method changes
Date
Msg-id 940.1291764904@sss.pgh.pa.us
Whole thread Raw
In response to Re: Final(?) proposal for wal_sync_method changes  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Final(?) proposal for wal_sync_method changes  (Josh Berkus <josh@agliodbs.com>)
List pgsql-hackers
I wrote:
> Some of us would make the same remark about Windows.  But we go out of
> our way to provide a safe default on that platform anyhow.

Oh, wait: that's not the case at all.  As of recent releases, we support
open_datasync on Windows, and that's the default despite being unsafe.
You have to go and choose some nondefault drive setting to make it safe:
http://developer.postgresql.org/pgdocs/postgres/wal-reliability.html

So if we drop open_datasync from the preference list then Windows users
*will* see a sudden huge change in the default behavior.

Because open_datasync does now exist on Windows, this code in
xlogdefs.h:#elif defined(HAVE_FSYNC_WRITETHROUGH_ONLY)#define DEFAULT_SYNC_METHOD
SYNC_METHOD_FSYNC_WRITETHROUGH
is actually dead code at the moment --- it can never be reached on any
platform.

I am unclear as to the reason why there is a test for
HAVE_FSYNC_WRITETHROUGH_ONLY in pg_fsync().  Perhaps that is also
leftover from a previous vision of how this all works?  Or does an
fsync() call actually fail on Windows?

I am now tempted to suggest that HAVE_FSYNC_WRITETHROUGH_ONLY should go
away altogether.  The documented and implemented behavior ought to be
that the default is "fdatasync if it exists, else fsync", full stop,
on every platform.  On both Windows and OS X, you would need to switch
to fsync_writethrough or change OS-level options to get safe behavior;
which is the same as it is today.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: Final(?) proposal for wal_sync_method changes
Next
From: Tom Lane
Date:
Subject: Re: Final(?) proposal for wal_sync_method changes