Re: pg_basebackup and replication slots

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_basebackup and replication slots
Date: 2015-07-29 08:17:04
Message-ID: CANP8+jKfD5ZXuG1pXC17thowJdBGv6i1zTpuwXfOaH7Ni+LeAw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 29 July 2015 at 09:09, Andres Freund <andres(at)anarazel(dot)de> wrote:

> On 2015-07-29 08:57:38 +0100, Simon Riggs wrote:
> > On 22 July 2015 at 05:43, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
> wrote:
> >
> >
> > > Now, do we plan to do something about the creation of a slot. I
> > > imagine that it would be useful if we could have --create-slot to
> > > create a slot when beginning a base backup and if-not-exists to
> > > control the error flow. There is already CreateReplicationSlot for
> > > this purpose in streamutils.c so most of the work is already done.
> > > Also, when a base backup fails for a reason or another, we should try
> > > to drop the slot in disconnect_and_exit() if it has been created by
> > > pg_basebackup. if if-not-exists is true and the slot already existed
> > > when beginning, we had better not dropping it perhaps...
> >
> >
> > What is the purpose of creating a temporary slot?
>
> > If we create a slot when one is needed and then drop automatically on
> > session disconnect (as Heikki suggest), what benefit does using a slot
> give
> > us?
>
> The goal is to have a reliable pg_basebackup that doesn't fail due to
> missing WAL (which can easily happen even with -X) . That seems like a
> sane desire.

Agreed, that is sane. Slots are good.

> 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.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2015-07-29 08:23:43 Re: Don'st start streaming after creating a slot in pg_receivexlog
Previous Message Andres Freund 2015-07-29 08:09:06 Re: pg_basebackup and replication slots