WAL and O_DIRECT - Mailing list pgsql-admin

From Ravi Krishna
Subject WAL and O_DIRECT
Date
Msg-id 14d52f362c9-2108-309cd@webstg-m03.mail.aol.com
Whole thread Raw
Responses Re: WAL and O_DIRECT  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-admin
As per PG 9.4 documentation:

wal_sync_method (enum)
Method used for forcing WAL updates out to disk. If fsync is off then this setting is irrelevant, since WAL file
updateswill not be forced out at all. Possible values are: 

open_datasync (write WAL files with open() option O_DSYNC)

fdatasync (call fdatasync() at each commit)

fsync (call fsync() at each commit)

fsync_writethrough (call fsync() at each commit, forcing write-through of any disk write cache)

open_sync (write WAL files with open() option O_SYNC)

The open_* options also use O_DIRECT if available. Not all of these choices are available on all platforms. The default
isthe first method in the above list that is supported by the platform, except that fdatasync is the default on Linux.
Thedefault is not necessarily ideal; it might be necessary to change this setting or other aspects of your system
configurationin order to create a crash-safe configuration or achieve optimal performance. These aspects are discussed
inSection 29.1. This parameter can only be set in the postgresql.conf file or on the server command line. 
===============

Our wal_sync_metho is opn_sync.

In RHEL 6.4, strace command shows PG opening the WAL files in the following mode

1431610784.573828 open("pg_xlog/0000000100000047000000A5", O_RDWR|O_DSYNC)

Why is O_DIRECT not used, despite the documentation mentioning otherwise?

On the same host, DB2 opens active logs (WAL) as follows
open("/bb/db/pgentdb/data001/db2/db2/NODE0000/SQL00001/LOGSTREAM0000/S0000001.LOG", O_RDWR|O_DSYNC|O_DIRECT)

We were expecting the same in PG too.

We are bench-marking PG vs DB2 for a new app.

Thanks.


pgsql-admin by date:

Previous
From: Mark Steben
Date:
Subject: Fwd: Two questions I would like insight on
Next
From: Tom Lane
Date:
Subject: Re: WAL and O_DIRECT