public inbox for [email protected]  
help / color / mirror / Atom feed
Manual Entries of commit_delay and commit_siblings are not complete.
3+ messages / 2 participants
[nested] [flat]

* Manual Entries of commit_delay and commit_siblings are not complete.
@ 2012-10-03 00:36 Tianyin Xu <[email protected]>
  2012-10-28 01:16 ` Manual Entries of commit_delay and commit_siblings are not complete. Tianyin Xu <[email protected]>
  2013-01-25 20:54 ` Re: Manual Entries of commit_delay and commit_siblings are not complete. Bruce Momjian <[email protected]>
  0 siblings, 2 replies; 3+ messages in thread

From: Tianyin Xu @ 2012-10-03 00:36 UTC (permalink / raw)
  To: pgsql-docs

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.

Thanks a lot!
Tianyin



-- 
Tianyin XU,
http://cseweb.ucsd.edu/~tixu/


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Manual Entries of commit_delay and commit_siblings are not complete.
  2012-10-03 00:36 Manual Entries of commit_delay and commit_siblings are not complete. Tianyin Xu <[email protected]>
@ 2012-10-28 01:16 ` Tianyin Xu <[email protected]>
  1 sibling, 0 replies; 3+ messages in thread

From: Tianyin Xu @ 2012-10-28 01:16 UTC (permalink / raw)
  To: pgsql-docs

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.

Thanks a lot!
Tianyin


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Manual Entries of commit_delay and commit_siblings are not complete.
  2012-10-03 00:36 Manual Entries of commit_delay and commit_siblings are not complete. Tianyin Xu <[email protected]>
@ 2013-01-25 20:54 ` Bruce Momjian <[email protected]>
  1 sibling, 0 replies; 3+ messages in thread

From: Bruce Momjian @ 2013-01-25 20:54 UTC (permalink / raw)
  To: Tianyin Xu <[email protected]>; +Cc: pgsql-docs

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  <[email protected]>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs


Attachments:

  [text/x-diff] fsync.diff (929B, 2-fsync.diff)
  download | inline 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 <varname>commit_delay</> is zero
!         (no delay).
         </para>
        </listitem>
       </varlistentry>
--- 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 <varname>commit_delay</> is zero
!         (no delay), and only honored if <varname>fsync</varname> is enabled.
         </para>
        </listitem>
       </varlistentry>


^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2013-01-25 20:54 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-10-03 00:36 Manual Entries of commit_delay and commit_siblings are not complete. Tianyin Xu <[email protected]>
2012-10-28 01:16 ` Tianyin Xu <[email protected]>
2013-01-25 20:54 ` Bruce Momjian <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox