pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jehan-Guillaume de Rorthais <jgdr@dalibo.com>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-committers <pgsql-committers@lists.postgresql.org>
Subject: Re: pgsql: walreceiver uses a temporary replication slot by default
Date: Tue, 11 Feb 2020 23:53:26 +0100
Message-ID: <20200211235326.412e3fe2@firost> (raw)
In-Reply-To: <739e2a5e-56d0-2a12-03ca-2c02631b1699@2ndquadrant.com>
References: <E1irMhK-00021w-9z@gemulon.postgresql.org>
	<CA+TgmoYYsp+uUo74tzboTBOL3WtQ4QJY6JU1wHWJG59UFNaDgg@mail.gmail.com>
	<739e2a5e-56d0-2a12-03ca-2c02631b1699@2ndquadrant.com>

Hello,

On Mon, 10 Feb 2020 16:37:53 +0100
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> wrote:

> On 2020-01-23 21:49, Robert Haas wrote:
> > On Tue, Jan 14, 2020 at 8:57 AM Peter Eisentraut <peter@eisentraut.org>
> > wrote:  
> >> walreceiver uses a temporary replication slot by default
> >>
> >> If no permanent replication slot is configured using
> >> primary_slot_name, the walreceiver now creates and uses a temporary
> >> replication slot.  A new setting wal_receiver_create_temp_slot can be
> >> used to disable this behavior, for example, if the remote instance is
> >> out of replication slots.
> >>
> >> Reviewed-by: Masahiko Sawada <masahiko.sawada@2ndquadrant.com>
> >> Discussion:
> >> https://www.postgresql.org/message-id/CA%2Bfd4k4dM0iEPLxyVyme2RAFsn8SUgrNtBJOu81YqTY4V%2BnqZA%40mail...  
> > 
> > Neither the commit message for this patch nor any of the comments in
> > the patch seem to explain why this is a desirable change.
> > 
> > I assume that's probably discussed on the thread that is linked here,
> > but you shouldn't have to dig through the discussion thread to figure
> > out what the benefits of a change like this are.  
> 
> You are right, this has gotten a bit lost in the big thread.
> 
> The rationale is basically the same as why client-side tools like 
> pg_basebackup use a temporary slot: So that the WAL data that they are 
> interested in doesn't disappear while they are connected.

In my humble opinion, I prefer the previous behavior, streaming without
temporary slot, for one reason: primary availability. 

Should the standby lag far behind the primary (no matter the root cause),
the standby was disconnected because of missing WAL. Worst case scenario, we
must rebuild it, hopefully from backups. Best case scenario, it fetches WALs
from PITR backup. As soon as the later is possible in the stack, I consider slot
like a burden from the operability point of view. If standbys can not fetch
archived WAL from PITR, then we can consider slots.

With temp slot created by default, if one standby lag far behind, it can make
the primary unavailable. We have nothing yet to forbid a slot to fill the
pg_wal partition. How new users creating their first cluster would react in such
situation? I suppose the original discussion was mostly targeting them?
Recovering from this is way more scary than building a standby.

So the default behavior might not be desirable and maybe
wal_receiver_create_temp_slot might be off by default?

Note that Kyotaro HORIGUCHI is working on a patch to restricting maximum keep
segments by repslots:

https://www.postgresql.org/message-id/flat/20190627162256.4f4872b8%40firost#6cba1177f766e7ffa5237789...

Regards,





view thread (17+ messages)  latest in thread

Message-ID: <20200211235326.412e3fe2@firost>
Permalink:  ../20200211235326.412e3fe2@firost/
Also on:    postgresql.org/message-id/20200211235326.412e3fe2@firost

 · 

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: jgdr@dalibo.com, peter.eisentraut@2ndquadrant.com, robertmhaas@gmail.com
  Subject: Re: pgsql: walreceiver uses a temporary replication slot by default
  In-Reply-To: <20200211235326.412e3fe2@firost>
  References: <E1irMhK-00021w-9z@gemulon.postgresql.org> <CA+TgmoYYsp+uUo74tzboTBOL3WtQ4QJY6JU1wHWJG59UFNaDgg@mail.gmail.com> <739e2a5e-56d0-2a12-03ca-2c02631b1699@2ndquadrant.com> <20200211235326.412e3fe2@firost>

* 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