Re: Create replication slot in pg_basebackup if requested and not yet present

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: Michael Banck <michael(dot)banck(at)credativ(dot)de>, Magnus Hagander <magnus(at)hagander(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Create replication slot in pg_basebackup if requested and not yet present
Date: 2017-09-08 17:30:20
Message-ID: CAMkU=1xv2ddkchdrOOTJb058DTN9toRXV3tr1aErSwiETj5VLA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 6, 2017 at 9:22 AM, Peter Eisentraut <
peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:

> On 8/18/17 05:28, Michael Banck wrote:
> >>> Rebased, squashed and slighly edited version attached. I've added this
> >>> to the 2017-07 commitfest now as well:
> >>>
> >>> https://commitfest.postgresql.org/14/1112/
> >> Can you rebase this past some conflicting changes?
> > Thanks for letting me know, PFA a rebased version.
>
> I have reviewed the thread so far. I think there is general agreement
> that something like this would be good to have.
>
> I have not found any explanation, however, why the "if not exists"
> behavior is desirable, let alone as the default. I can only think of
> two workflows here: Either you have scripts for previous PG versions
> that create the slot externally, in which can you omit --create, or you
> use the new functionality to have pg_basebackup create the slot. I
> don't see any use for pg_basebackup to opportunistically use a slot if
> it happens to exist. Even if there is one, it should not be the
> default. So please change that.
>

+1. I'd rather just get an error and re-run without the --create switch.
That way you are forced to think about what you are doing.

Is there a race condition here? The slot is created after the checkpoint
is completed. But you have to start streaming from the LSN where the
checkpoint started, so shouldn't the slot be created before the checkpoint
is started?

Cheers,

Jeff

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2017-09-08 17:31:33 Re: PoC plpgsql - possibility to force custom or generic plan
Previous Message Catalin Iacob 2017-09-08 17:24:44 Re: [bug fix] Savepoint-related statements terminates connection