Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TyqID-00063w-FQ for pgsql-docs@arkaria.postgresql.org; Fri, 25 Jan 2013 20:54:33 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TyqID-0005rp-0K for pgsql-docs@arkaria.postgresql.org; Fri, 25 Jan 2013 20:54:33 +0000 Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TyqIC-0005rk-Fz for pgsql-docs@postgresql.org; Fri, 25 Jan 2013 20:54:32 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TyqI9-0006MG-M7 for pgsql-docs@postgresql.org; Fri, 25 Jan 2013 20:54:31 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1TyqI8-0002lC-F6; Fri, 25 Jan 2013 15:54:28 -0500 Date: Fri, 25 Jan 2013 15:54:28 -0500 From: Bruce Momjian To: Tianyin Xu Cc: pgsql-docs@postgresql.org Subject: Re: Manual Entries of commit_delay and commit_siblings are not complete. Message-ID: <20130125205428.GQ6848@momjian.us> References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="qoTlaiD+Y2fIM3Ll" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org --qoTlaiD+Y2fIM3Ll Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Oct 2, 2012 at 05:36:28PM -0700, Tianyin Xu wrote: > Hi, pgsql-docs, > > I was confused by the system behavior of PG's write ahead log, specifically the > relation between commit_delay, commit_siblings, and fsync. > > Basically according to the manual (http://www.postgresql.org/docs/9.1/static/ > runtime-config-wal.html), I know: > > "commit_delay" specifies the delay before a transaction attempts to flush the > WAL buffer out to disk. > "commit_siblings" specifies minimum number of concurrent open transactions to > require before performing the commit_delay delay. > > However, after looking at the code, I figured out these configuration > parameters are also controlled by fsync. > > The only usage of the two parameter I can find is: > > /* src/backend/access/transam/xact.c */ > > static TransactionId > RecordTransactionCommit(void) > ... > if (CommitDelay > 0 && > enableFsync && > MinimumActiveBackends(CommitSiblings)) > pg_usleep(CommitDelay); > > ... > } > > where, CommitDelay stores the parameter of "commit_delay", CommitSiblings > stores the parameter of "commit_siblings", and enableFsync stores the parameter > of "fsync". > > It seems the two parameters (commit_delay and commit_siblings) only have effect > when fsync is set to be *on*. > > But, unfortunately, such behavior is not covered in the manual. The mistake I > made is only set the two values but disabling fsync so the expected PG does not > behave as I expected. I think it's definitely helpful to specify the relations > between these configuration parameters either in the manual, or in the source > code by giving warnings logs. Docs updated for PG 9.3 with the attached patch. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + It's impossible for everything to be true. + --qoTlaiD+Y2fIM3Ll Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="fsync.diff" diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml new file mode 100644 index 5f47c1f..19f513e *** a/doc/src/sgml/config.sgml --- b/doc/src/sgml/config.sgml *************** include 'filename' *** 1968,1974 **** the first process that becomes ready to flush waits for the configured interval, while subsequent processes wait only until the leader completes the flush. The default commit_delay is zero ! (no delay). --- 1968,1974 ---- the first process that becomes ready to flush waits for the configured interval, while subsequent processes wait only until the leader completes the flush. The default commit_delay is zero ! (no delay), and only honored if fsync is enabled. --qoTlaiD+Y2fIM3Ll Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs --qoTlaiD+Y2fIM3Ll--