Re: Why ALTER SUBSCRIPTION ... SET (slot_name='none') requires subscription disabled?

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Japin Li <japinli(at)hotmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Why ALTER SUBSCRIPTION ... SET (slot_name='none') requires subscription disabled?
Date: 2021-07-09 12:03:10
Message-ID: CAEudQAq3FGXNfe_cvdd1L9oFh9G91uqgCn5fsLRp7Qrwxo0ofg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em qui., 8 de jul. de 2021 às 23:50, Japin Li <japinli(at)hotmail(dot)com>
escreveu:

>
> On Thu, 08 Jul 2021 at 18:17, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> > On Thu, Jul 8, 2021 at 3:43 PM Japin Li <japinli(at)hotmail(dot)com> wrote:
> >>
> >> On Thu, 08 Jul 2021 at 17:51, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
> wrote:
> >> > On Wed, Jul 7, 2021 at 7:25 PM Japin Li <japinli(at)hotmail(dot)com> wrote:
> >> >>
> >> >> Hi, hackers
> >> >>
> >> >> The documentation [1] says:
> >> >>
> >> >> When dropping a subscription that is associated with a replication
> slot on the
> >> >> remote host (the normal state), DROP SUBSCRIPTION will connect to
> the remote
> >> >> host and try to drop the replication slot as part of its operation.
> This is
> >> >> necessary so that the resources allocated for the subscription on
> the remote
> >> >> host are released. If this fails, either because the remote host is
> not
> >> >> reachable or because the remote replication slot cannot be dropped
> or does not
> >> >> exist or never existed, the DROP SUBSCRIPTION command will fail. To
> proceed in
> >> >> this situation, disassociate the subscription from the replication
> slot by
> >> >> executing ALTER SUBSCRIPTION ... SET (slot_name = NONE).
> >> >>
> >> >> However, when I try this, it complains the subscription is enabled,
> this command
> >> >> requires the subscription disabled. Why we need this limitation?
> >> >>
> >> >
> >> > If we don't have this limitation then even after you have set the slot
> >> > name to none, the background apply worker corresponding to that
> >> > subscription will continue to stream changes via the previous slot.
> >> >
> >>
> >> Yeah, thanks for your explain! Should we add some comments here?
> >>
> >
> > Sure, but let's keep that as a separate HEAD-only patch.
>
> Please consider review v3 patch. v3-0001 adds slot_name verification in
> parse_subscription_options() and comments for why we need disable
> subscription
> where set slot_name to NONE. v3-0002 comes from Ranier Vilela, it reduce
> the
> overhead strlen in ReplicationSlotValidateName().
>
+1 Seems good.

regards,
Ranier Vilela

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2021-07-09 13:31:05 Re: [PATCH] Automatic HASH and LIST partition creation
Previous Message Kyotaro Horiguchi 2021-07-09 12:00:31 Re: ERROR: "ft1" is of the wrong type.