Re: [COMMITTERS] pgsql: Make WAL segment size configurable at initdb time.

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Make WAL segment size configurable at initdb time.
Date: 2017-09-20 05:51:45
Message-ID: CAB7nPqTfaKAYZ4wuUM-W8kc4VnXrxX1=5-a9i==VoUPTMFpsgg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Wed, Sep 20, 2017 at 2:04 PM, Andres Freund <andres(at)anarazel(dot)de> wrote:
> 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.

I have been reading through this commit, and there is one change in
streamutil.c which is really unwelcome:
+ /* for previous versions set the default xlog seg size */
+ if (PQserverVersion(conn) < MINIMUM_VERSION_FOR_SHOW_CMD)
+ {
+ WalSegSz = DEFAULT_XLOG_SEG_SIZE;
+ return true;
+ }
Because of this pg_receivewal will generate silently incorrect WAL
segment data if connecting with builds of PostgreSQL 10 or older
versions which do not have the default segment size of 16MB set. If
this patch justifies such breakages, I think that this should just
fail instead to tell users that it is better to use an older version
of pg_receivewal compatible with the build of this server. Better safe
than sorry.

--- a/src/bin/pg_test_fsync/pg_test_fsync.c
+++ b/src/bin/pg_test_fsync/pg_test_fsync.c
@@ -64,7 +64,7 @@ static const char *progname;

static int secs_per_test = 5;
static int needs_unlink = 0;
-static char full_buf[XLOG_SEG_SIZE],
+static char full_buf[DEFAULT_XLOG_SEG_SIZE],
Did you consider adding an option --wal-segzize to pg_test_fsync?

+ * This is default value for wal_segment_size to be used at intidb when run
Typo here: s/intidb/initdb/.
--
Michael

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2017-09-20 05:58:59 Re: [COMMITTERS] pgsql: Make WAL segment size configurable at initdb time.
Previous Message Andres Freund 2017-09-20 05:04:30 pgsql: Make WAL segment size configurable at initdb time.

Browse pgsql-hackers by date

  From Date Subject
Next Message Vaishnavi Prabakaran 2017-09-20 05:56:07 [PATCH] Minor patch to correct symbol name in logs
Previous Message Thomas Munro 2017-09-20 05:46:19 Re: Error: dsa_area could not attach to a segment that has been freed