Re: WAL and O_DIRECT

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Ravi Krishna <s(dot)ravikrishna(at)aim(dot)com>
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-admin(at)postgresql(dot)org
Subject: Re: WAL and O_DIRECT
Date: 2015-05-14 16:26:10
Message-ID: 20150514162610.GB23739@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Thu, May 14, 2015 at 12:07:04PM -0400, Ravi Krishna wrote:
> >> However our DB2 folks are raising a concern that PG WAL writes may not be crash safe, unless we are using
> >> write back technology in SAN or SSD , which we are using.
>
> > What's your point exactly? If the underlying hardware does not provide durable writes, there's
> > nothing PG (or DB2) can do to fix that.
>
>
> Am I right in concluding that PG WAL writes without underlying h/w caching is not crash proof.
> Fortunately these days caching is ubiquitous in all SSD/SAN technology. Both Oracle and DB2 always open WAL
> logs in O_DIRECT. Is this thinking outdated with modern technology which caches writes. Wonder why Oracle/DB2
> are not making O_DIRECT optional. I am sure it will increase the write performance.

Basically, O_DIRECT writes through the OS catch directly to the storage.
Postgres writes to the OS cache, then uses fsync() or another OS call to
flush that OS write to the storage --- we just do it in two parts.

We turn off O_DIRECT for WAL writes because we know another process is
going to read it soon, so in that case, we fall back the two-part
solution of OS write and fsync-like OS call.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Ravi Krishna 2015-05-14 16:29:04 Re: WAL and O_DIRECT
Previous Message Tom Lane 2015-05-14 16:25:28 Re: WAL and O_DIRECT