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

From Kyotaro HORIGUCHI
Subject Re: [HACKERS] Create replication slot in pg_basebackup ifrequested and not yet present
Date
Msg-id 20170322.160925.89175016.horiguchi.kyotaro@lab.ntt.co.jp
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>)
List pgsql-hackers
Hello, I favor this feature.

At Wed, 22 Mar 2017 00:18:19 -0400, Peter Eisentraut <peter.eisentraut@2ndquadrant.com> wrote in
<1f5daba9-773d-9281-5608-37f049025bb3@2ndquadrant.com>
> On 3/21/17 15:34, Robert Haas wrote:
> > So I tend to think that there should always be some explicit user
> > action to cause the creation of a slot, like --create-slot-if-needed
> > or --create-slot=name.  That still won't prevent careless use of that
> > option but it's less dangerous than assuming that a user who refers to
> > a nonexistent slot intended to create it when, perhaps, they just
> > typo'd it.
> 
> I have the same concern.

A slot created as !immeediately_reserve (even though currently
CREATE_REPLICATION_SLOT command doesn't seem to have the option)
won't do such a trick but I agree to the point. I think that any
explicit action is required unless any anticipated catastrophic
end caused by remainig slots is evaded implicitly.

Do ephemeral or temporary slots help this case?

Otherwise, I'm proposing a patch to ignore restart-lsn of slots
that let too many WALs to stay on.

https://www.postgresql.org/message-id/20170228.122736.123383594.horiguchi.kyotaro@lab.ntt.co.jp

Instaed just ignoring restart-lsn, like Andres' suggestion,
removing (or just disabling) a slot that is marked as
'auto-removable' with the same kind (including disconnection
timeout) of trigger also will work.


I had a similar annoyance with CREATE SUBSCRIPTION. It implicitly
creates a slot on publisher and subscriber fails to have the same
subscription after re-initialization. Of couse DROP SUBSCRIPTION
doesn't help the case. Users don't have a clue to solution, I
suppose. But this would be another topic.


regards,

-- 
Kyotaro Horiguchi
NTT Open Source Software Center




pgsql-hackers by date:

Previous
From: Rafia Sabih
Date:
Subject: Re: [HACKERS] Enabling parallelism for queries coming from SQL orother PL functions
Next
From: Simon Riggs
Date:
Subject: Re: [HACKERS] [PATCH] Transaction traceability - txid_status(bigint)