Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Ysv7W-0003h4-Uj for pgsql-admin@arkaria.postgresql.org; Thu, 14 May 2015 15:32:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Ysv7W-0005DE-7c for pgsql-admin@arkaria.postgresql.org; Thu, 14 May 2015 15:32:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Ysv7V-0005D6-EG for pgsql-admin@postgresql.org; Thu, 14 May 2015 15:32:21 +0000 Received: from omr-m09.mx.aol.com ([64.12.143.82]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1Ysv7Q-000119-Oz for pgsql-admin@postgresql.org; Thu, 14 May 2015 15:32:20 +0000 Received: from mtaomg-maa01.mx.aol.com (mtaomg-maa01.mx.aol.com [172.26.222.143]) by omr-m09.mx.aol.com (Outbound Mail Relay) with ESMTP id 2944A7057522C; Thu, 14 May 2015 11:32:13 -0400 (EDT) Received: from core-lka04e.mail.aol.com (core-lka04.mail.aol.com [10.76.33.4]) by mtaomg-maa01.mx.aol.com (OMAG/Core Interface) with ESMTP id F287738000082; Thu, 14 May 2015 11:32:12 -0400 (EDT) Received: from 69.191.241.48 by webstg-m03.mail.aol.com (10.74.51.128) with HTTP (WebMailUI); Thu, 14 May 2015 11:32:12 -0400 Date: Thu, 14 May 2015 11:32:12 -0400 From: Ravi Krishna To: tgl@sss.pgh.pa.us Cc: pgsql-admin@postgresql.org Message-Id: <14d530df35f-2108-30ce7@webstg-m03.mail.aol.com> In-Reply-To: <20588.1431616292@sss.pgh.pa.us> Subject: Re: WAL and O_DIRECT MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_295587_591101141.1431617532766" X-MB-Message-Source: WebUI X-MB-Message-Type: User X-Mailer: JAS STD X-Originating-IP: [69.191.241.48] x-aol-global-disposition: G DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mx.aim.com; s=20140625; t=1431617533; bh=gk0tvyojchAnB6ZrN6uLTuKXl5LChUN+lp83K3u32+0=; h=From:To:Subject:Message-Id:Date:MIME-Version:Content-Type; b=IaoFWq1EkEa87/HPAVvHzw2F7x/MPwkaxQs/h4aXogY5W22w/mL6dwOAUo6qRhsxN yVx8S9tgMTTq++tfQiZ2C22m1pTMyivRrU3KWNM61BsmQj/Af2xiMg2t6eGq6gUgZw Zno4okqSGYdBi9tQZKzxJx1afxawJ9oDcHRPpMNA= x-aol-sid: 3039ac1ade8f5554bffc296a X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org ------=_Part_295587_591101141.1431617532766 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Aha that pretty much explains it. Yes we are using streaming replication. 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. -----Original Message----- From: Tom Lane To: Ravi Krishna Cc: pgsql-admin Sent: Thu, May 14, 2015 11:11 am Subject: Re: [ADMIN] WAL and O_DIRECT Ravi Krishna 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 ------=_Part_295587_591101141.1431617532766 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit Aha that pretty much explains it. Yes we are using streaming replication.

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.


-----Original Message-----
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ravi Krishna <s.ravikrishna@aim.com>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Sent: Thu, May 14, 2015 11:11 am
Subject: Re: [ADMIN] WAL and O_DIRECT

Ravi Krishna <s.ravikrishna@aim.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
------=_Part_295587_591101141.1431617532766--