Re: WAL and O_DIRECT

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ravi Krishna <s(dot)ravikrishna(at)aim(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: WAL and O_DIRECT
Date: 2015-05-14 15:11:32
Message-ID: 20588.1431616292@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Ravi Krishna <s(dot)ravikrishna(at)aim(dot)com> writes:
> Why is O_DIRECT not used, despite the documentation mentioning otherwise?

You've not shown us all your settings, but this comment in xlog.c might
explain it:

* Optimize writes by bypassing kernel cache with O_DIRECT when using
* O_SYNC/O_FSYNC and O_DSYNC. But only if archiving and streaming are
* disabled, otherwise the archive command or walsender process will read
* the WAL soon after writing it, which is guaranteed to cause a physical
* read if we bypassed the kernel cache. We also skip the
* posix_fadvise(POSIX_FADV_DONTNEED) call in XLogFileClose() for the same
* reason.

regards, tom lane

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Ravi Krishna 2015-05-14 15:32:12 Re: WAL and O_DIRECT
Previous Message Ravi Krishna 2015-05-14 15:03:11 WAL and O_DIRECT