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

From Tom Lane
Subject Re: O_DIRECT for WAL writes
Date
Msg-id 13664.1117466694@sss.pgh.pa.us
Whole thread Raw
In response to Re: O_DIRECT for WAL writes  (Neil Conway <neilc@samurai.com>)
Responses Re: O_DIRECT for WAL writes
List pgsql-patches
Neil Conway <neilc@samurai.com> writes:
> On Mon, 2005-05-30 at 02:52 -0400, Tom Lane wrote:
> Well, that claims that "data is guaranteed to have been transferred",
> but transferred to *where* is the question :)

Oh, I see what you are worried about.  I think you are right: what the
doc promises is only that the DMA transfer has finished (ie, it's safe
to scribble on your buffer again).  So you'd still need an fsync;
which makes O_DIRECT orthogonal to wal_sync_method rather than a
valid choice for it.  (Hm, I wonder if specifying both O_DIRECT and
O_SYNC works ...)

> The other question is whether these semantics are identical among the
> various O_DIRECT implementations (e.g. Linux, FreeBSD, AIX, IRIX, and
> others).

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?  Without this, an
application reading the WAL using normal non-O_DIRECT I/O might see the
wrong data; which is bad news for PITR.

            regards, tom lane

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] patches for items from TODO list
Next
From: Bruce Momjian
Date:
Subject: Support only octal for psql PROMPT % values