Re: O_DIRECT for WAL writes - Mailing list pgsql-patches

From Neil Conway
Subject Re: O_DIRECT for WAL writes
Date
Msg-id 1117501707.6678.18.camel@localhost.localdomain
Whole thread Raw
In response to Re: O_DIRECT for WAL writes  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
On Mon, 2005-05-30 at 11:24 -0400, Tom Lane wrote:
> Wouldn't count on it :-(.  One thing I'm particularly worried about is
> buffer cache consistency: does the kernel guarantee to flush any buffers
> it has that overlap the O_DIRECT write operation?

At least on Linux I believe the kernel guarantees consistency between
O_DIRECT and non-O_DIRECT operations. From googling, it seems AIX also
provides consistency, albeit not for free[1]:

        To avoid consistency issues, if there are multiple calls to open
        a file and one or more of the calls did not specify O_DIRECT and
        another open specified O_DIRECT, the file stays in the normal
        cached I/O mode. Similarly, if the file is mapped into memory
        through the shmat() or mmap() system calls, it stays in normal
        cached mode. If the last conflicting, non-direct access is
        eliminated, then the file system will move the file into direct
        I/O mode (either by using the close(), munmap(), or shmdt()
        subroutines). Changing from normal mode to direct I/O mode can
        be expensive because all modified pages in memory will have to
        be flushed to disk at that point.

-Neil

[1]
http://publib16.boulder.ibm.com/pseries/en_US/aixbman/prftungd/diskperf9.htm


pgsql-patches by date:

Previous
From: Mark Kirkwood
Date:
Subject: Re: [HACKERS] pg_buffercache causes assertion failure
Next
From: Neil Conway
Date:
Subject: Re: [HACKERS] pg_buffercache causes assertion failure