pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@postgresql.org
Subject: pgsql: Replace checkpoint_segments with min_wal_size and max_wal_size.
Date: Mon, 23 Feb 2015 16:53:31 +0000
Message-ID: <E1YPwGB-0006vL-8V@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Replace checkpoint_segments with min_wal_size and max_wal_size.

Instead of having a single knob (checkpoint_segments) that both triggers
checkpoints, and determines how many checkpoints to recycle, they are now
separate concerns. There is still an internal variable called
CheckpointSegments, which triggers checkpoints. But it no longer determines
how many segments to recycle at a checkpoint. That is now auto-tuned by
keeping a moving average of the distance between checkpoints (in bytes),
and trying to keep that many segments in reserve. The advantage of this is
that you can set max_wal_size very high, but the system won't actually
consume that much space if there isn't any need for it. The min_wal_size
sets a floor for that; you can effectively disable the auto-tuning behavior
by setting min_wal_size equal to max_wal_size.

The max_wal_size setting is now the actual target size of WAL at which a
new checkpoint is triggered, instead of the distance between checkpoints.
Previously, you could calculate the actual WAL usage with the formula
"(2 + checkpoint_completion_target) * checkpoint_segments + 1". With this
patch, you set the desired WAL usage with max_wal_size, and the system
calculates the appropriate CheckpointSegments with the reverse of that
formula. That's a lot more intuitive for administrators to set.

Reviewed by Amit Kapila and Venkata Balaji N.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/88e982302684246e8af785e78a467ac37c76dee9

Modified Files
--------------
doc/src/sgml/config.sgml                      |   40 +++-
doc/src/sgml/perform.sgml                     |   16 +-
doc/src/sgml/wal.sgml                         |   69 ++++---
src/backend/access/transam/xlog.c             |  262 ++++++++++++++++++++-----
src/backend/postmaster/checkpointer.c         |    6 +-
src/backend/utils/misc/guc.c                  |   30 ++-
src/backend/utils/misc/postgresql.conf.sample |    3 +-
src/include/access/xlog.h                     |    8 +-
src/include/utils/guc.h                       |    1 +
9 files changed, 327 insertions(+), 108 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


view thread (2+ messages)  latest in thread

Message-ID: <E1YPwGB-0006vL-8V@gemulon.postgresql.org>
Permalink:  ../E1YPwGB-0006vL-8V@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1YPwGB-0006vL-8V@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: heikki.linnakangas@iki.fi
  Subject: Re: pgsql: Replace checkpoint_segments with min_wal_size and max_wal_size.
  In-Reply-To: <E1YPwGB-0006vL-8V@gemulon.postgresql.org>
  References: <E1YPwGB-0006vL-8V@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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