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.96) (envelope-from ) id 1vaETp-005YXo-2V for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Dec 2025 14:44:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vaETn-00Gyuc-15 for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Dec 2025 14:44:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vaETm-00GyuU-1i for pgsql-hackers@lists.postgresql.org; Mon, 29 Dec 2025 14:44:15 +0000 Received: from fhigh-b5-smtp.messagingengine.com ([202.12.124.156]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vaETl-003BwP-1t for pgsql-hackers@lists.postgresql.org; Mon, 29 Dec 2025 14:44:14 +0000 Received: from phl-compute-11.internal (phl-compute-11.internal [10.202.2.51]) by mailfhigh.stl.internal (Postfix) with ESMTP id 0F7E57A007A; Mon, 29 Dec 2025 09:44:12 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-11.internal (MEProxy); Mon, 29 Dec 2025 09:44:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kurilemu.de; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to; s=fm3; t=1767019451; x= 1767105851; bh=H8olg+BsLLpzUcQ7HzkETq6yvDrktmZB6ZMnWoUkEQE=; b=S Y4rDH1bbIat7mIEVPmZcer52iv1GZFuj6WGyk1h28RRK2BGPfU6jej0Wll7PGFsS 3Rz8Sfy4TqwJMyPnPsyyR6ydTqNvrXJvXR671ECIXV9YpIGsw+DNgyZMYo3edx3P MikYHK8bXQasKubqMmsXCpvFZUPVQjAus5U8LKWqSSMo+7TXjjMS/Y3evrMJf96p xI8gn+54CL6/HVvDsLuqaHIWNFat5qGH6iUWBrovxQpFrcaMUNrRVIdv5fnrM3RS NTh0olMx1iyf16xlMfrX86LAZAjNaHSEpa/J1eznxkbTGu3H3JtK5nyJY4sc8ctq Z1SuRhJGrQdpAS7oBmrxQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1767019451; x=1767105851; bh=H 8olg+BsLLpzUcQ7HzkETq6yvDrktmZB6ZMnWoUkEQE=; b=bjhT8tzEUw9Vor2kO B484dtG6Qag5DpYfvgHwE+EbccW8THKKH1TC+ePpuV0RZmIZL9/6Qf7GO6nNG+EM Ee1+qg+lKwJ2kTb+6vrWdYYwM4J0vPzfNAviOIqQ1SQvMPBt5N+pRgkKH0l3enYr d8GlkmsB7nP7WfGuMNnfSYhlaWLeP02h3SG2/QZ8cXnSIYt78v1+JRvE/wN5PmLQ 51bzgBEGxp1hvRtkD7Ap0281pEpJD/7uwyGh2Y2+KbayJkB0WmeP+UOuLEiSw/X4 nWmjQhVt9nRWvuibU4FRCisVzmXpR/TI3nP+la1PrpxLFxXBi0r0rMNtLSQ+AcL7 jKeJw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdejjeegudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpeffhffvvefukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpemllhhvrghrohcu jfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgeskhhurhhilhgvmhhurdguvgeqnecuggftrf grthhtvghrnhepveehuddvvefggeeutddtkeegleektdehfeelleffhffhudetgfeigeeu vdduhfeunecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomhdpthifihhtth gvrhdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhr ohhmpegrlhhvhhgvrhhrvgeskhhurhhilhgvmhhurdguvgdpnhgspghrtghpthhtohepfe dpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoheprghshhhuthhoshhhrdgsrghprght rdhoshhssehgmhgrihhlrdgtohhmpdhrtghpthhtoheplhhirdgvvhgrnhdrtghhrghose hgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrsheslhhishht shdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ie3de48e3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Dec 2025 09:44:10 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kurilemu.de; s=schmee; t=1767019398; bh=PV5mOZgh5JU5CU+OHYuA2OCpOwz0EXMZi1tdv6PZBbc=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=sn5n6SCeZXavbOXQCKvveQ25FaHezEcToGyFMNxqCmgmjnykAODHyLGsJA6cMv0o8 pX0zHn04Q0vbx0M6R9RI0bL80tbbJ2G7jfKUuS3N9qsG5zoLGKMnFx9ICsFo5Y2TuV SLgEc0qbW48V3I5KnrYiJD3GiisMes0btevIayYEK0LLRyGcrM007K7FstPPKp94UL dDJJv6vYKz6nMBvv8JJpb5L28CHNaSHPNj9puViHr7KN0zzIshVpzRj0bhu3GrN4KA 6oF39DC4DuqLp/sysLFDkHgzpG3GO3BSs3dNHsJI9HZQgBEErBTbJedm/zSLAfMUh+ OaTO57GXu7KWQ== Received: by schmee.kurilemu.internal (Postfix, from userid 1000) id AD07F78; Mon, 29 Dec 2025 15:43:18 +0100 (CET) Date: Mon, 29 Dec 2025 11:43:18 -0300 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: Ashutosh Bapat Cc: Chao Li , Postgres hackers Subject: Re: Refactor replication origin state reset helpers Message-ID: <202512291435.5edkf3hnichv@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 2025-Dec-24, Ashutosh Bapat wrote: > If we go this route, we at least need to declare the new functions as > static inline and move them to a header file instead of .c file. Hmm, why would we make them static inline instead of standard (extern) functions? We use static inline functions when we want to avoid the overhead of a function call in a hot code path, but I doubt that's the case here. Am I mistaken on this? > Further, does it make sense to put together all the state variables > into a single structure? Yeah -- keeping the threaded-backend project in mind, moving them to a single struct seems to make sense. I think it's a separate patch though because it'd be more invasive than Chao's initial patch, as those variables are used in many places. > It's also quite easy to confuse between these functions and > replorigin_session_reset(). It's not clear where the boundaries of the > latter end and where those of the new ones start. I think the latter > deals with the shared memory structures while the new ones deal with > the backend local state. And then there's replorigin_reset() which > adds to the confusion. That function doesn't call > replorigin_session_reset() which the other two callers of > replorigin_session_clear_state() call. Why? I think there is more to > clean here than what's in the patch. That doesn't mean that we cannot > accept this patch without larger cleanup, but it should not add to the > existing confusion. Good points. A decrease in the total quantity of cruft would be a good outcome of a patch in this area. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "Update: super-fast reaction on the Postgres bugs mailing list. The report was acknowledged [...], and a fix is under discussion. The wonders of open-source !" https://twitter.com/gunnarmorling/status/1596080409259003906