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 1w9Se3-001SB6-1U for pgsql-hackers@arkaria.postgresql.org; Sun, 05 Apr 2026 18:56:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w9Se1-004R0I-2i for pgsql-hackers@arkaria.postgresql.org; Sun, 05 Apr 2026 18:56:26 +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.96) (envelope-from ) id 1w9Se1-004R05-1Y for pgsql-hackers@lists.postgresql.org; Sun, 05 Apr 2026 18:56:25 +0000 Received: from fhigh-b2-smtp.messagingengine.com ([202.12.124.153]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w9Sdy-00000000lnj-3jdT for pgsql-hackers@lists.postgresql.org; Sun, 05 Apr 2026 18:56:25 +0000 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfhigh.stl.internal (Postfix) with ESMTP id 034367A012D; Sun, 5 Apr 2026 14:56:19 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Sun, 05 Apr 2026 14:56:20 -0400 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=1775415379; x=1775501779; bh=9 i+p5Fukb9g+h7Kw867LUCDNQt+30sdF2uMvWA8jH8M=; b=fO1G+8RNV2Iw1rBbp FK2nIzIXaB20FKecidoUUMBSX96QWF+CbWhA4zkVEcH5HpkuNBvcCl7G0CRcsqp9 YOx44DbjZhkyHEnlynWgS9YHdcuQGlXk6nzPZBccK+hKBdMjKcBEF5qltYdG7qqh 5f0tFbfAZEZBN2Xj8lgWRpviE+f4lzIBe+L5qU/pkqng35ZAgi9fCR8DwP7PFxY0 sxt7XHRdbNfVqnTBhn/KqvE0i0nowE5IuCmeGDCJdL1d8a5+cv0tC2wYIaMuixpC qmpeW5AKovJjBXa94WOe2Z0vXFHwbbl6QMcq4Mfc8AGKC0TP7Dn7sw6LgG5laZ2y BLSTg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdduheehiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpeffhffvvefukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhvrghrohcu jfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqeenuc ggtffrrghtthgvrhhnpedvkedtffduffdtffffheffhfejjefhgfeiueeukeejkeffgfdu fffhudffffeuveenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmnecuve hluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghr rhgvsegrlhhvhhdrnhhoqdhiphdrohhrghdpnhgspghrtghpthhtohepjedpmhhouggvpe hsmhhtphhouhhtpdhrtghpthhtoheprghhsegthigsvghrthgvtgdrrghtpdhrtghpthht oheprghmihhtrdhkrghpihhlrgduieesghhmrghilhdrtghomhdprhgtphhtthhopegsoh gvkhgvfihurhhmodhpohhsthhgrhgvshesghhmrghilhdrtghomhdprhgtphhtthhopehm ihhhrghilhhnihhkrghlrgihvghusehgmhgrihhlrdgtohhmpdhrtghpthhtohepshhrih hnrghthhdvudeffeesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggt khgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrghdprhgtphhtthhopehroh gsseigiihilhhlrgdrnhgvth X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 5 Apr 2026 14:56:19 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1775415376; bh=52JtDYRUZ9oVVTnXjtPszHDB9gQOdmqs/RG7+B1MtHE=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=V/eiPyXk7jWC+ChvGuKuec34YzCYIqMHLBKFeNAF9vjaXhif+aqVUPndkjefJgTg6 fHOO4fIW9Bltr/MV5DJ+IXGQSj1o+bimgqppQWyfYI9ALTtyXvyU+kWsI+zBnHw9yT GHL6BtsfJpdcibWryMRHOUxeEwBf4kzyrwVEXvbki/bamL/3a3Qbzgyc9+mLoaQalk NdcQs2iGmhVXLMh5yk6AeOOd3QccFaZAkRzVErqgzgKbbujt/4qia/RGtJQlt4bePX g4yoJvDRWIEIltFtQZLG+8Sfrhooo3k8BYkitCPQTTuYjiVKhXwdJvGLCsYr1OD1b5 uSJH6Q5B3tDZg== Received: by schmee.kurilemu.internal (Postfix, from userid 1000) id 2E9627C; Sun, 05 Apr 2026 20:56:16 +0200 (CEST) Date: Sun, 5 Apr 2026 20:56:16 +0200 From: Alvaro Herrera To: Antonin Houska Cc: Srinath Reddy Sadipiralla , Amit Kapila , Mihail Nikalayeu , Matthias van de Meent , Pg Hackers , Robert Treat Subject: Re: Adding REPACK [concurrently] Message-ID: <202604051852.qfdnfvemfkd2@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <24165.1775406641@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, So I've been trying to understand the "Introduce an option to make logical replication database specific." patch and I have to confess I just cannot. As far as I can read, the point is that if we reach SnapBuildProcessRunningXacts() when db_specific is true (which means standby_decode is called in an output plugin that has set need_shared_catalogs to false), _and_ we've not reached consistent state yet, then we'll call LogStandbySnapshot with our DB oid to emit a new xl_running_xacts message. So the WAL-decoding process emits WAL. I don't know if in normal conditions logical decoding processes emit WAL. If this is exceptional, I think we should add a comment. Now, this additional WAL message will be processed by all other processes decoding WAL. Perhaps it will ignored by most of them. But most importantly, it will also reach back to ourselves, at which point we can hopefully use it to see that we might have reached consistent state within our database. Then we know our snapshot is ready to be used. Is this correct? I think the reason it's safe to skip a lot of the processing caused by this additional process, is that xl_running_xacts messages are also emitted in other places in a non-database specific manner. So all the other placecs that are emitting that message continue to exist and cause logical-decoders operate in the same way as before. I think we should sprinkle lots of comments in several places about this. For example, I propose that standby_redo() should have something like * If 'dbid' is valid, only gather transactions running in that database. + * Such records should not be the only ones emitted, because this has + * potentially dangerous side-effects which makes some places ignore them: + * + * 1. SnapBuildProcessRunningXacts will skip computing the xmin and restart + * point from its input record if the record's xmin is older that the + * snapbuilder's current xmin; this should normally be fine because that + * information will be updated from other xl_running_xacts records. + * 2. standby_redo will likewise skip processing such a record * (are there other things that should be mentioned?) Also, LogStandbySnapshot() should have a comment explaining that passing a valid dboid is a weird corner case which is to be used with care, and that functions X Y and Z are going to ignore snapshots carrying a valid dbid. Why do we call SnapBuildFindSnapshot() to do this, instead of doing it directly in SnapBuildProcessRunningXacts? Seems like it would be more straightforward. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/