Re: Synchronizing slots from primary to standby - Mailing list pgsql-hackers

From Drouvot, Bertrand
Subject Re: Synchronizing slots from primary to standby
Date
Msg-id 69090ef8-297c-4715-ae50-0b6e5cce2497@gmail.com
Whole thread Raw
In response to RE: Synchronizing slots from primary to standby  ("Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>)
Responses Re: Synchronizing slots from primary to standby
List pgsql-hackers
Hi,

On 11/2/23 1:27 AM, Zhijie Hou (Fujitsu) wrote:
> On Tuesday, October 31, 2023 6:45 PM Amit Kapila <amit.kapila16@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.

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



pgsql-hackers by date:

Previous
From: Alexander Korotkov
Date:
Subject: Re: XID formatting and SLRU refactorings (was: Add 64-bit XIDs into PostgreSQL 15)
Next
From: Heikki Linnakangas
Date:
Subject: Re: PostgreSql: Canceled on conflict out to old pivot