Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pP3K6-0007QH-KN for pgsql-bugs@arkaria.postgresql.org; Mon, 06 Feb 2023 15:22:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pP3K5-0006dM-EG for pgsql-bugs@arkaria.postgresql.org; Mon, 06 Feb 2023 15:22:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pP3K5-0006dD-5t for pgsql-bugs@lists.postgresql.org; Mon, 06 Feb 2023 15:22:25 +0000 Received: from wnew3-smtp.messagingengine.com ([64.147.123.17]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pP3K2-0002Lq-HG for pgsql-bugs@lists.postgresql.org; Mon, 06 Feb 2023 15:22:24 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailnew.west.internal (Postfix) with ESMTP id 499BD2B0683B; Mon, 6 Feb 2023 10:22:19 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 06 Feb 2023 10:22:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1675696938; x=1675704138; bh=f 5JLa4LYBZYerOt5bL8/2/y4fyW+guy/KG0NXdwf888=; b=PEWoZof5iS5xzHry/ tw7sppfCTfFGAZUVoYYvqZOzhLqGZMbx/HzPjGe0xVifk/OVSKjWHdT0SRajSMXM cwOIi/HflFtNof8BPTtUeGxDTT4EA16jO7/6b/56ZpTEaNlzjJcKxGPlf9a50RMx 40+W+KqrwlcOCZ9cERUkeXE9zX3xA9nnnWQ9TxXhVEEE8nUdGK6DspAoJ8ap63RA yG2dk0Cg3y+hQhjsHy3gWUWHNhh9Ep18XyFQEkLY5HAgWWp55Or601vWjXl34QCq exg6S2WuljI1z8ADSUe6zQQH3cMcoru0Vr3SbduLQz7hSlH+cbPM1J3/pQvnnovF POTsw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudegiedgjeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffhjeejhffgieeuueekjeek fffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhv hhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 6 Feb 2023 10:22:18 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 6E3DC9A; Mon, 6 Feb 2023 16:22:09 +0100 (CET) Date: Mon, 6 Feb 2023 16:22:09 +0100 From: Alvaro Herrera To: Masahiko Sawada Cc: depesz@depesz.com, Amit Kapila , PostgreSQL mailing lists Subject: Re: WAL segments removed from primary despite the fact that logical replication slot needs it. Message-ID: <20230206152209.yglmntznhcmaueyn@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-Feb-06, Masahiko Sawada wrote: > I've also confirmed that this issue is fixed by the attached patch, > which clears candidate_restart_lsn and friends during > ReplicationSlotRelease(). Hmm, interesting -- I was studying some other bug recently involving the xmin of a slot that had been invalidated and I remember wondering if these "candidate" fields were being properly ignored when the slot is marked not in use; but I didn't check. Are you sure that resetting them when the slot is released is the appropriate thing to do? I mean, shouldn't they be kept set while the slot is in use, and only reset if we destroy it? (But, actually, in that case, maybe we don't need to reset them: instead we need to make sure to ignore the values for slots that are not in_use. However, I don't know what the semantics are for these "candidate" fields, so maybe this is wrong.) -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/