Re: pg_basebackup and replication slots - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: pg_basebackup and replication slots
Date
Msg-id CANP8+j+85Hyn7hi0G+6bJTC77PfdW+mEHWbk2ik4=GoaDP_MEg@mail.gmail.com
Whole thread Raw
In response to Re: pg_basebackup and replication slots  (Andres Freund <andres@anarazel.de>)
Responses Re: pg_basebackup and replication slots
List pgsql-hackers
On 29 July 2015 at 11:43, Andres Freund <andres@anarazel.de> wrote:
On 2015-07-29 09:17:04 +0100, Simon Riggs wrote:
> On 29 July 2015 at 09:09, Andres Freund <andres@anarazel.de> wrote:
> > The point of using a temporary slot is to not have a
> > leftover slot afterwards, reserving resources. Especially important if
> > the basebackup actually failed...
> >
>
> Creating a slot and then deleting it if the session disconnects does not
> successfully provide the functionality desired above.

Uh? If you create the slot, start streaming, and then start the
basebackup, it does. It does *not* guarantee that the base backup can be
converted into a replica, but it's sufficient to guarantee it can
brought out of recovery.

Perhaps we are misunderstanding the word "it" here. "it can be brought out of recovery"?

You appear to be saying that a backup that disconnects before completion is useful in some way. How so?

If the slot is cleaned up on disconnect, as suggested, then you end up with half a backup and WAL is cleaned up. The only possible use for slots is to reserve resources (as you say); the resources will clearly not be reserved if we drop the slot on disconnect. What use is that?

--
Simon Riggs                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: LWLock deadlock and gdb advice
Next
From: Simon Riggs
Date:
Subject: Re: MultiXact member wraparound protections are now enabled