Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uKBKg-00FXHI-5H for pgsql-bugs@arkaria.postgresql.org; Wed, 28 May 2025 07:36:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uKBKe-00FD8S-J5 for pgsql-bugs@arkaria.postgresql.org; Wed, 28 May 2025 07:36:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uKBKe-00FD8J-AE for pgsql-bugs@lists.postgresql.org; Wed, 28 May 2025 07:36:12 +0000 Received: from fhigh-b6-smtp.messagingengine.com ([202.12.124.157]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uKBKb-000Vyi-2F for pgsql-bugs@lists.postgresql.org; Wed, 28 May 2025 07:36:11 +0000 Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfhigh.stl.internal (Postfix) with ESMTP id C4BB525400E3; Wed, 28 May 2025 03:36:08 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Wed, 28 May 2025 03:36:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1748417768; x=1748504168; bh=L6yrfliPmK y/bsgo/i9f1y6C1BwccENDbLSeiORR4yk=; b=ZM8xIryr/IMBZR9AtF8hJIlYzf 7ekx1yqNL0QrWP6WSEUyvdUIrwgc0fyAJwdwsYiGyGHopl5C3WL3oqK5z4yVTIpn o+V6Z6t92i8Irsutk4XqBzlBAGCIAJh6hGCHSs0wPDExCsk9yzidtsiIg9LygnIV K1SK3yofz4MdJpkZ8E2z7CdUvkm8dH13QWQuCy4wRx6Wy/gFiCfaGGrRK+FaIYQM eAy8RLfpZl84dlY5/TkaDK4xdF9xGdEm+rWvyQ+4Nq3p/Y60x2qUiZLz2st/ja8E 7ngjyH5CqdCJBD1hEPDktGYHVr4COz886IMELCmd4QFckelQvJm2POxdKz9g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1748417768; x=1748504168; bh=L6yrfliPmKy/bsgo/i9f1y6C1BwccENDbLS eiORR4yk=; b=KShfVu+cNuSt8zS67dOfE5Nl+rt27PaSg+F/cq1m0FMgcrBzXC7 uirTlvznCR5ahFgTlHorIJjW7ZmZcuu7sMwbrZGEgGPfoVtyyaOnNmlzxMWAaefk TlnoiStJmVBvvr54CFodkEwBDWtfKy21ie6rbYjUqC6Sk2hfciri9pzCudSTe+xs d65hVq7uc3ictpLoekGTyph+DiGDVRTdi3sl5yTg8dsPygV+AsY4oe9NeCPUiZFC C3kpPcWok1WvxHl1FFefXBfqmznYdVGiwk318X14iPVOMpLBQXL11e57MwScQf1q XtRQhRp+THYDOiq0aLXCVSOUJyGrEc812fQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddtgddvvdeikeculddtuddrgeefvddrtd dtmdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggft fghnshhusghstghrihgsvgdpuffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftd dtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlhcuvffnffculdejtddm necujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofhitg hhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprghquhhivghrrdighiiiqeen ucggtffrrghtthgvrhhnpeetleeifedufffhhfdtteelgeeggeffhfekueevteeigfduud evudetgfegiedvjeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhl fhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiiipdhnsggprhgtphhtthhope ehpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegrrdhmrghkhhhmuhhtohhvsehp ohhsthhgrhgvshhprhhordhruhdprhgtphhtthhopegsvghrthhrrghnuggurhhouhhvoh htrdhpghesghhmrghilhdrtghomhdprhgtphhtthhopehshhhvvghtrgdrmhgrlhhikhes ghhmrghilhdrtghomhdprhgtphhtthhopehithhsrghjihhnsehgmhgrihhlrdgtohhmpd hrtghpthhtohepphhgshhqlhdqsghughhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdr ohhrgh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 28 May 2025 03:36:06 -0400 (EDT) Date: Wed, 28 May 2025 16:35:58 +0900 From: Michael Paquier To: Alexey Makhmutov Cc: Bertrand Drouvot , shveta malik , Ajin Cherian , pgsql-bugs@lists.postgresql.org Subject: Re: Standby server with cascade logical replication could not be properly stopped under load Message-ID: References: <52138028-7246-421c-9161-4fa108b88070@postgrespro.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="9Ina7Ak1Wo21WnsW" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --9Ina7Ak1Wo21WnsW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --9Ina7Ak1Wo21WnsW Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmg2vN4ACgkQnvQgOdby QH3VGg//e3FYzykAezZ2XdMfDj1IuZV29zkOg6UufoGdlfBiu2PQdHX4UkhUub0A E9tTLy1tM1OCo/0AYKav3VGYFI+stQB3Ay2nfjLt/CnJtl8RtTDDGl9Yt44jhkmq KB2G2mqhogLERv4HOARB2MdSN+edkXwPWl7WsYhmoLexPiS9Hry19WhD/ograF/L yP2rsTV6jN+1pygiXsu20bJHgkBJ8x6a0znGAUyiQGZsAKqqj0nLwbHoCEX0ByQ2 NiA9peYUHNxDzdEQMLVvDACbrOW2RBaipkq+RnE2nuWeTTcQo0mL+/TPG0IJBx6O 0f4FSixKRqEDw9qGzm6LyJVrX38aK3/QsuLKvcAos1dKdMojSdwH6NcAInbCrEK6 qSFyi8ZBDXwBBEQIDvg1rRTIURbLEZs5FyvLbrO9Gv+qq6Hr5IBejnOo5H2YGZ6m lvkyX74M78QDaRjWSibL4u/8NIIVDSR4yolkLBlU6OpsnZOSoFqj/sr0Lu8pbng8 8czQmLPeG8qa+cPhspyGqkyntriZR+TEmE9y0dTmvUIhMcJoufb9OTz4lFvJz84i 5QCYTL+1BMTCLoUFqmvQbiyxc+EOs3crH7D1rauNGSAivXM4YiJKvFSeFwYR3yUf E77weEdxHI50Y0pOzS3MzkFb9x9sstmeUEVu8LeO7FqgpXSL0tw= =DWUW -----END PGP SIGNATURE----- --9Ina7Ak1Wo21WnsW--