pgsql: Make WAL segment size configurable at initdb time.

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Make WAL segment size configurable at initdb time.
Date: 2017-09-20 05:04:30
Message-ID: E1duXBW-0003QB-4d@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Make WAL segment size configurable at initdb time.

For performance reasons a larger segment size than the default 16MB
can be useful. A larger segment size has two main benefits: Firstly,
in setups using archiving, it makes it easier to write scripts that
can keep up with higher amounts of WAL, secondly, the WAL has to be
written and synced to disk less frequently.

But at the same time large segment size are disadvantageous for
smaller databases. So far the segment size had to be configured at
compile time, often making it unrealistic to choose one fitting to a
particularly load. Therefore change it to a initdb time setting.

This includes a breaking changes to the xlogreader.h API, which now
requires the current segment size to be configured. For that and
similar reasons a number of binaries had to be taught how to recognize
the current segment size.

Author: Beena Emerson, editorialized by Andres Freund
Reviewed-By: Andres Freund, David Steele, Kuntal Ghosh, Michael
Paquier, Peter Eisentraut, Robert Hass, Tushar Ahuja
Discussion: https://postgr.es/m/CAOG9ApEAcQ--1ieKbhFzXSQPw_YLmepaa4hNdnY5+ZULpt81Mw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/fc49e24fa69a15efacd5b8958115ed9c43c48f9a

Modified Files
--------------
configure | 54 -----
configure.in | 31 ---
contrib/pg_standby/pg_standby.c | 115 +++++++++--
doc/src/sgml/backup.sgml | 2 +-
doc/src/sgml/installation.sgml | 14 --
doc/src/sgml/ref/initdb.sgml | 15 ++
doc/src/sgml/wal.sgml | 13 +-
src/backend/access/transam/twophase.c | 3 +-
src/backend/access/transam/xlog.c | 255 ++++++++++++++----------
src/backend/access/transam/xlogarchive.c | 14 +-
src/backend/access/transam/xlogfuncs.c | 10 +-
src/backend/access/transam/xlogreader.c | 32 +--
src/backend/access/transam/xlogutils.c | 36 ++--
src/backend/bootstrap/bootstrap.c | 15 +-
src/backend/postmaster/checkpointer.c | 5 +-
src/backend/replication/basebackup.c | 34 ++--
src/backend/replication/logical/logical.c | 2 +-
src/backend/replication/logical/reorderbuffer.c | 19 +-
src/backend/replication/slot.c | 2 +-
src/backend/replication/walreceiver.c | 14 +-
src/backend/replication/walreceiverfuncs.c | 4 +-
src/backend/replication/walsender.c | 16 +-
src/backend/utils/misc/guc.c | 20 +-
src/backend/utils/misc/pg_controldata.c | 5 +-
src/backend/utils/misc/postgresql.conf.sample | 2 +-
src/bin/initdb/initdb.c | 58 +++++-
src/bin/pg_basebackup/pg_basebackup.c | 7 +-
src/bin/pg_basebackup/pg_receivewal.c | 16 +-
src/bin/pg_basebackup/receivelog.c | 36 ++--
src/bin/pg_basebackup/streamutil.c | 76 +++++++
src/bin/pg_basebackup/streamutil.h | 2 +
src/bin/pg_controldata/pg_controldata.c | 15 +-
src/bin/pg_resetwal/pg_resetwal.c | 55 +++--
src/bin/pg_rewind/parsexlog.c | 30 ++-
src/bin/pg_rewind/pg_rewind.c | 12 +-
src/bin/pg_rewind/pg_rewind.h | 1 +
src/bin/pg_test_fsync/pg_test_fsync.c | 7 +-
src/bin/pg_upgrade/test.sh | 4 +-
src/bin/pg_waldump/pg_waldump.c | 246 ++++++++++++++++-------
src/include/access/xlog.h | 1 +
src/include/access/xlog_internal.h | 76 ++++---
src/include/access/xlogreader.h | 8 +-
src/include/catalog/pg_control.h | 2 +-
src/include/pg_config.h.in | 5 -
src/include/pg_config_manual.h | 6 +
src/tools/msvc/Solution.pm | 2 -
46 files changed, 897 insertions(+), 500 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2017-09-20 05:51:45 Re: [COMMITTERS] pgsql: Make WAL segment size configurable at initdb time.
Previous Message Andres Freund 2017-09-20 04:42:15 Re: [HACKERS] Re: pgsql: Make new crash restart test a bit more robust.

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2017-09-20 05:06:32 Re: increasing the default WAL segment size
Previous Message Craig Ringer 2017-09-20 05:01:08 Re: src/test/subscription/t/002_types.pl hanging on particular environment