Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id CEEB31337B7D for ; Fri, 5 Nov 2010 20:33:03 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 53919-05 for ; Fri, 5 Nov 2010 23:32:58 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-iw0-f174.google.com (mail-iw0-f174.google.com [209.85.214.174]) by mail.postgresql.org (Postfix) with ESMTP id 6194B1337B49 for ; Fri, 5 Nov 2010 20:32:56 -0300 (ADT) Received: by iwn41 with SMTP id 41so1455465iwn.19 for ; Fri, 05 Nov 2010 16:32:56 -0700 (PDT) Received: by 10.42.176.199 with SMTP id bf7mr1375607icb.527.1288999976495; Fri, 05 Nov 2010 16:32:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.39.130 with HTTP; Fri, 5 Nov 2010 16:32:26 -0700 (PDT) In-Reply-To: <4CD47FCD.6010106@2ndquadrant.com> References: <4CCDCAA3.4050805@2ndquadrant.com> <201011010010.28724.andres@anarazel.de> <4CD472CC.80006@2ndquadrant.com> <4CD47FCD.6010106@2ndquadrant.com> From: Marti Raudsepp Date: Sat, 6 Nov 2010 01:32:26 +0200 Message-ID: Subject: Re: Defaulting wal_sync_method to fdatasync on Linux for 9.1? To: Greg Smith Cc: Andres Freund , pgsql-performance@postgresql.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201011/79 X-Sequence-Number: 41103 On Sat, Nov 6, 2010 at 00:06, Greg Smith wrote: > =C2=A0Please refrain from making changes to popular documents like the > tuning guide on the wiki based on speculation about what's happening. I will grant you that the details were wrong, but I stand by the conclusion= . I can state for a fact that PostgreSQL's default wal_sync_method varies depending on the header. I have two PostgreSQL 9.0.1 builds, one with older /usr/include/bits/fcntl.h and one with newer. When I run "show wal_sync_method;" on one instance, I get fdatasync. On the other one I get open_datasync. So let's get down to code. Older fcntl.h has: #define O_SYNC 010000 # define O_DSYNC O_SYNC /* Synchronize data. */ Newer has: #define O_SYNC 04010000 # define O_DSYNC 010000 /* Synchronize data. */ So you can see that in the older header, O_DSYNC and O_SYNC are equal. src/include/access/xlogdefs.h does: #if defined(O_SYNC) #define OPEN_SYNC_FLAG O_SYNC ... #if defined(OPEN_SYNC_FLAG) /* O_DSYNC is distinct? */ #if O_DSYNC !=3D OPEN_SYNC_FLAG #define OPEN_DATASYNC_FLAG O_DSYNC ^ it's comparing O_DSYNC !=3D O_SYNC #if defined(OPEN_DATASYNC_FLAG) #define DEFAULT_SYNC_METHOD SYNC_METHOD_OPEN_DSYNC #elif defined(HAVE_FDATASYNC) #define DEFAULT_SYNC_METHOD SYNC_METHOD_FDATASYNC ^ depending on whether O_DSYNC and O_SYNC were equal, the default wal_sync_method will change. Regards, Marti