Re: Synchronizing slots from primary to standby

From: "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: shveta malik <shveta(dot)malik(at)gmail(dot)com>, 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-08 07:02:34
Message-ID: a4e9bcc4-ea96-4909-9ee1-19c6f7eebfb4@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 11/8/23 4:50 AM, Amit Kapila wrote:
> On Tue, Nov 7, 2023 at 7:58 PM Drouvot, Bertrand
> <bertranddrouvot(dot)pg(at)gmail(dot)com> wrote:
>>
>> If we think this window is too short we could:
>>
>> - increase it
>> or
>> - don't drop the slot once created (even if there is no activity
>> on the primary during PrimaryCatchupWaitAttempt attempts) so that
>> the next loop of attempts will compare with "older" LSN/xmin (as compare to
>> dropping and re-creating the slot). That way the window would be since the
>> initial slot creation.
>>
>
> Yeah, this sounds reasonable but we can't mark such slots to be
> synced/available for use after failover.

Yeah, currently we are fine as slots are dropped in wait_for_primary_slot_catchup() if
we are not in recovery anymore.

> I think if we want to follow
> this approach then we need to also monitor these slots for any change
> in the consecutive cycles and if we are able to sync them then
> accordingly we enable them to use after failover.

What about to add a new field in ReplicationSlotPersistentData
indicating that we are waiting for "sync" and drop such slots during promotion and
/or if not in recovery?

> Another somewhat related point is that right now, we just wait for the
> change on the first slot (the patch refers to it as the monitoring
> slot) for computing nap_time before which we will recheck all the
> slots. I think we can improve that as well such that even if any
> slot's information is changed, we don't consider changing naptime.
>

Yeah, that sounds reasonable to me.

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 Peter Eisentraut 2023-11-08 07:16:55 Re: GenBKI emits useless open;close for catalogs without rows
Previous Message John Naylor 2023-11-08 07:02:02 Re: [PGDOCS] Inconsistent linkends to "monitoring" views.