On Tue, Nov 28, 2023 at 2:17 PM Drouvot, Bertrand
<bertranddrouvot...@gmail.com> wrote:
>
> On 11/2/23 1:27 AM, Zhijie Hou (Fujitsu) wrote:
> > On Tuesday, October 31, 2023 6:45 PM Amit Kapila <amit.kapil...@gmail.com> 
> > wrote:
> >> We have create_replication_slot and drop_replication_slot in repl_gram.y. 
> >> How
> >> about if introduce alter_replication_slot and handle the 'failover' flag 
> >> with that?
> >> The idea is we will either enable 'failover' at the time 
> >> create_replication_slot by
> >> providing an optional failover option or execute a separate command
> >> alter_replication_slot. I think we probably need to perform this command
> >> before the start of streaming.
> >
> > Here is an attempt to achieve the same. I added a new replication command
> > alter_replication_slot and introduced a walreceiver api walrcv_alter_slot to
> > execute the command. The subscription will call the api to enable/disable
> > the failover of the slot on publisher.
> >
> > The patch disallows altering the failover option for the subscription. But 
> > we
> > could release the restriction by using the following approaches in next 
> > version:
> >
> >> I think we will have the following options to allow alter of the 'failover'
> >> property: (a) we can allow altering 'failover' only for the 'disabled'
> >> subscription; to achieve that, we need to open a connection during alter
> >> subscription and change this property of slot; (b) apply worker detects the
> >> change in 'failover' option; run the alter_replication_slot command; this 
> >> needs
> >> more analysis as apply_worker is already doing streaming and changing slot
> >> property in between could be tricky.
> >
>
> What do you think about also adding a pg_alter_logical_replication_slot() or 
> such
> function?
>
> That would allow users to alter manually created logical replication slots 
> without
> the need to make a replication connection.
>

But then won't that make it inconsistent with the subscription
failover state? I think if we don't have a simple solution for this,
we can always do it as an enhancement to the main feature once we have
good ideas to solve it.

-- 
With Regards,
Amit Kapila.


Reply via email to