From: Michael Paquier <michael@paquier.xyz>
To: Alexey Makhmutov <a.makhmutov@postgrespro.ru>
Cc: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Cc: shveta malik <shveta.malik@gmail.com>
Cc: Ajin Cherian <itsajin@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: Standby server with cascade logical replication could not be properly stopped under load
Date: Wed, 28 May 2025 16:35:58 +0900
Message-ID: <aDa83q7wJt6II3Iq@paquier.xyz> (raw)
In-Reply-To: <f2575904-acfe-4037-9748-61fdb4a7abe4@postgrespro.ru>
References: <52138028-7246-421c-9161-4fa108b88070@postgrespro.ru>
<CAJpy0uA9kw9WLWETPg+upwzBu145vMB7sPZwBuR_vDrbazeuag@mail.gmail.com>
<d9e1c765-7f83-4015-ade3-16506854d0b1@postgrespro.ru>
<aC9DXHt/MwFCW6Is@ip-10-97-1-34.eu-west-3.compute.internal>
<f2575904-acfe-4037-9748-61fdb4a7abe4@postgrespro.ru>
On Thu, May 22, 2025 at 09:22:02PM +0300, Alexey Makhmutov wrote:
> I've tried to update method comment as well in the updated patch:
> 0001-Use-only-replayed-position-as-target-flush-point-3-pg-master.patch.
> The same patch could be applied on top of PG 17 as well.
+ if (MyWalSnd->kind == REPLICATION_KIND_PHYSICAL)
+ {
+ TimeLineID receiveTLI;
+ XLogRecPtr receivePtr = GetWalRcvFlushRecPtr(NULL, &receiveTLI);
+
+ if (receiveTLI == replayTLI && receivePtr > result)
+ result = receivePtr;
+ }
Looking at the patch, I am not much a fan of looking at MyWalSnd in
GetStandbyFlushRecPtr() which does not have such a dependency yet, to
then decide if the LSN retrieved by GetWalRcvFlushRecPtr() should be
removed or used.
Wouldn't it be better to extend GetStandbyFlushRecPtr() so as the
caller can directly decide if they want to include in the maths the
last LSN flushed by the WAL receiver, depending on the code path where
the routine is called? That makes for a larger patch, of course, but
it removes the need to look at MyWalSnd inside
GetStandbyFlushRecPtr().
--
Michael
Attachments:
[application/pgp-signature] signature.asc (832B, ../aDa83q7wJt6II3Iq@paquier.xyz/2-signature.asc)
download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: michael@paquier.xyz, a.makhmutov@postgrespro.ru, bertranddrouvot.pg@gmail.com, shveta.malik@gmail.com, itsajin@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: Standby server with cascade logical replication could not be properly stopped under load
In-Reply-To: <aDa83q7wJt6II3Iq@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox