Re: [HACKERS] Create replication slot in pg_basebackup if requestedand not yet present - Mailing list pgsql-hackers

From Jeff Janes
Subject Re: [HACKERS] Create replication slot in pg_basebackup if requestedand not yet present
Date
Msg-id CAMkU=1xv2ddkchdrOOTJb058DTN9toRXV3tr1aErSwiETj5VLA@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Create replication slot in pg_basebackup if requestedand not yet present  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: [HACKERS] Create replication slot in pg_basebackup if requestedand not yet present  (Michael Banck <michael.banck@credativ.de>)
List pgsql-hackers
On Wed, Sep 6, 2017 at 9:22 AM, Peter Eisentraut <peter.eisentraut@2ndquadrant.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

pgsql-hackers by date:

Previous
From: Catalin Iacob
Date:
Subject: Re: [HACKERS] [bug fix] Savepoint-related statements terminates connection
Next
From: Pavel Stehule
Date:
Subject: Re: [HACKERS] PoC plpgsql - possibility to force custom or generic plan