Re: Synchronizing slots from primary to standby

From: "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>
Cc: Peter Smith <smithpb2250(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Ajin Cherian <itsajin(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Subject: Re: Synchronizing slots from primary to standby
Date: 2023-11-28 08:47:24
Message-ID: 69090ef8-297c-4715-ae50-0b6e5cce2497@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)kapila16(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2023-11-28 08:53:41 Re: PostgreSql: Canceled on conflict out to old pivot
Previous Message Alexander Korotkov 2023-11-28 08:35:13 Re: XID formatting and SLRU refactorings (was: Add 64-bit XIDs into PostgreSQL 15)