Re: pg_basebackups and slots

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_basebackups and slots
Date: 2016-12-15 09:26:30
Message-ID: CABUevEwNpdpzr=hSz7OpkUjTWsgAuDioYrkgvE5ppiJxYq8Aew@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 15, 2016 at 10:04 AM, Magnus Hagander <magnus(at)hagander(dot)net>
wrote:

> I've started work on a patch to make pg_basebackup use the temporary slots
> feature that has been committed (thanks Petr!!). The reason for this is to
> avoid the cases where a burst of traffic on the master during the backup
> can cause the receive log part of the basebackup to fall far enough behind
> that it fails.
>
> I have a few considerations at this point, about interaction with existing
> options.
>
> Right now, we have -S/--slot which specifies a slot name. If you want to
> use that, you have to create the slot ahead of time, and it will be a
> permanent slot (of course). This is primarily documented as a feature to
> use for replication (to make sure xlog is kept around until the standby is
> started up), but it does also solve the same problem. But to use it for
> base backups today you have to manually create the slot, then base backup,
> then drop the slot, which is error prone.
>
> My thought is that if -S/--slot is not specified, but -X stream is, then
> we use a temporary slot always. This obviously requires the server to be
> configured with enough slots (I still think we should change the default
> here, but that's a different topic), but I think that's acceptable. Then we
> should add a "--no-slot" to make it revert to previous behaviour.
>
> Does that seem reasonable? Or would people prefer it to default to off?
>
>
> However, it also made me think that the interface for setting up a replica
> with a *permanent* slot would be much nicer if we could just have
> pg_basebackup create the slot, instead of having to create it manually.
>
> Basically, I'm envisioning adding an IF_NOT_EXISTS argument to
> CREATE_REPLICATION_SLOT, so that pg_basebackup can pass up the slot name it
> wants to use and have it created if necessary. Do people think think this
> is worth doing? (It would also make pg_receivexlog and pg_receivelogical
> easier to use, I think, and it would obviously be implemented there as
> well).
>
>
Pah, nevermind this last question. I was looking a completely broken
branch -- we already have the if-not-exists parameter for
pg_receivexlog/pg_receivelogical. I shouldn't write emails before
thinking...

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Law 2016-12-15 09:30:17 Re: [COMMITTERS] pgsql: Build HTML documentation using XSLT stylesheets by default
Previous Message Heikki Linnakangas 2016-12-15 09:25:10 Re: Crash on promotion when recovery.conf is renamed