From: | Marti Raudsepp <marti(at)juffo(dot)org> |
---|---|
To: | Greg Smith <greg(at)2ndquadrant(dot)com> |
Cc: | Andres Freund <andres(at)anarazel(dot)de>, pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Defaulting wal_sync_method to fdatasync on Linux for 9.1? |
Date: | 2010-11-05 23:32:26 |
Message-ID: | AANLkTimhNzer1TOEnL55P-Un9TPp8fAeyOzX09259RxN@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On Sat, Nov 6, 2010 at 00:06, Greg Smith <greg(at)2ndquadrant(dot)com> wrote:
> Please refrain from making changes to popular documents like the
> tuning guide on the wiki based on speculation about what's happening.
I will grant you that the details were wrong, but I stand by the conclusion.
I can state for a fact that PostgreSQL's default wal_sync_method
varies depending on the <fcntl.h> header.
I have two PostgreSQL 9.0.1 builds, one with older
/usr/include/bits/fcntl.h and one with newer.
When I run "show wal_sync_method;" on one instance, I get fdatasync.
On the other one I get open_datasync.
So let's get down to code.
Older fcntl.h has:
#define O_SYNC 010000
# define O_DSYNC O_SYNC /* Synchronize data. */
Newer has:
#define O_SYNC 04010000
# define O_DSYNC 010000 /* Synchronize data. */
So you can see that in the older header, O_DSYNC and O_SYNC are equal.
src/include/access/xlogdefs.h does:
#if defined(O_SYNC)
#define OPEN_SYNC_FLAG O_SYNC
...
#if defined(OPEN_SYNC_FLAG)
/* O_DSYNC is distinct? */
#if O_DSYNC != OPEN_SYNC_FLAG
#define OPEN_DATASYNC_FLAG O_DSYNC
^ it's comparing O_DSYNC != O_SYNC
#if defined(OPEN_DATASYNC_FLAG)
#define DEFAULT_SYNC_METHOD SYNC_METHOD_OPEN_DSYNC
#elif defined(HAVE_FDATASYNC)
#define DEFAULT_SYNC_METHOD SYNC_METHOD_FDATASYNC
^ depending on whether O_DSYNC and O_SYNC were equal, the default
wal_sync_method will change.
Regards,
Marti
From | Date | Subject | |
---|---|---|---|
Next Message | Pierre C | 2010-11-05 23:39:05 | Re: Defaulting wal_sync_method to fdatasync on Linux for 9.1? |
Previous Message | Scott Carey | 2010-11-05 22:30:22 | Re: Major Linux performance regression; shouldn't we be worried about RHEL6? |