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 1vpZYl-00BKyj-0B for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Feb 2026 22:16:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vpZYk-00CmRp-06 for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Feb 2026 22:16:45 +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 1vpZYj-00CmRg-0R for pgsql-hackers@lists.postgresql.org; Mon, 09 Feb 2026 22:16:45 +0000 Received: from fhigh-a8-smtp.messagingengine.com ([103.168.172.159]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vpZYf-00000001t2Z-47SH for pgsql-hackers@postgresql.org; Mon, 09 Feb 2026 22:16:44 +0000 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfhigh.phl.internal (Postfix) with ESMTP id 83F7A14000FF; Mon, 9 Feb 2026 17:16:39 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Mon, 09 Feb 2026 17:16:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; 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=fm3; t=1770675399; x=1770761799; bh=GFftQccyNx bPcv+gz6pYuFT9NYyR7PMVY8RwNsCwO4I=; b=aomZleFc8EpM5kJyVngWol20o+ N1ZRYaGV6nWF4FWUU9HxQ4iN2wiP8BeY/iPVqHH2cjX7+7ynOt25qOtxejicRPgA 7Nj51mD6cFun6jtp+qza2nbPBt3ed+3m3JbXQaJ8T3KzhW9xnHDtonDzClYhPrxp 366XWy5KO3dECnhFPffY9sRdONDrrGbGKJaHUxr6WkPvzby+Y3t79S0bLyDja4X1 /LkRXsAHqu0jMD3vLY8FRYqpcGqYdA1Vevl/6TujawliO1Nf5UGgZbKquCZ1Qz1d in0l5s6FkcdOVZ15s9D3u7vYZ8JgAS0B7Sj2am+y61sAdMf/NPHsh5qi9upQ== 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=fm3; t= 1770675399; x=1770761799; bh=GFftQccyNxbPcv+gz6pYuFT9NYyR7PMVY8R wNsCwO4I=; b=rpC3J9a9dYq7Ejwm5xI9tYOUHR+VPnzeFnMKgsmuCV3IqyzQ+6G Z4QjB+AlR6YHLMp5zIYFciphot3J3QaM+yUItDAtPmkl9MaLunNzyZpODbIWHm/y BK3lBCqUyUe9Drich0Z6PAHannhUTt+bpz4uCWIuXK7CacQf19SZvwQZjlPQ5S9W MUlmrBsYT2huaXS7C1j44hlyqJeAVlpaUnwZV1UhKYFwM4m3gak3Ho+vNZ5tMk01 AIY5EuPoP0tRHtrf63vBB164x27GrcxHyCTGYOR+lErFJdn05PAVILCjB0rxn27K sxS7/VZrzZDQhFb0qxpcoj3vyWowNcyWoRQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdduleejleekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughrvghs ucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrfgrth htvghrnhepvdfffeevhfetveffgeeiteefhfdtvdffjeevhfeuteegleduheetveduieet tddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hnughrvghssegrnhgrrhgriigvlhdruggvpdhnsggprhgtphhtthhopedutddpmhhouggv pehsmhhtphhouhhtpdhrtghpthhtoheprghhsegthigsvghrthgvtgdrrghtpdhrtghpth htohepsghovghkvgifuhhrmhdophhoshhtghhrvghssehgmhgrihhlrdgtohhmpdhrtghp thhtohepmhgvlhgrnhhivghplhgrghgvmhgrnhesghhmrghilhdrtghomhdprhgtphhtth hopehmihgthhgrvghlrdhprghquhhivghrsehgmhgrihhlrdgtohhmpdhrtghpthhtohep rhgvshhhkhgvkhhirhhilhhlsehgmhgrihhlrdgtohhmpdhrtghpthhtoheprhhosggvrh htmhhhrggrshesghhmrghilhdrtghomhdprhgtphhtthhopehthhhomhgrshdrmhhunhhr ohesghhmrghilhdrtghomhdprhgtphhtthhopehhlhhinhhnrghkrgesihhkihdrfhhipd hrtghpthhtohepnhhorghhsehlvggruggsohgrthdrtghomh X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 9 Feb 2026 17:16:38 -0500 (EST) Date: Mon, 9 Feb 2026 17:16:38 -0500 From: Andres Freund To: Antonin Houska Cc: Kirill Reshke , Heikki Linnakangas , Melanie Plageman , Matthias van de Meent , pgsql-hackers@postgresql.org, Thomas Munro , Noah Misch , Robert Haas , Michael Paquier Subject: Re: Buffer locking is special (hints, checksums, AIO writes) Message-ID: References: <1108f18d-cf7c-4f17-b29c-a119fe42f7e5@iki.fi> <5dwlfu2jyzkyf3nrlzxxblxctb6xio5es73ptgsahjnmfu5miu@772rc764hfhi> <4csodkvvfbfloxxjlkgsnl2lgfv2mtzdl7phqzd4jxjadxm4o5@usw7feyb5bzf> <61812.1770637345@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <61812.1770637345@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2026-02-09 12:42:25 +0100, Antonin Houska wrote: > Andres Freund wrote: > > > On 2026-01-12 12:45:03 -0500, Andres Freund wrote: > > > I'm doing another pass through 0003 and will push that if I don't find > > > anything significant. > > > > Done, after adjust two comments in minor ways. > > I suppose this is commit 0b96e734c590. > > While troubleshooting REPACK issue [1], I realized that > HeapTupleSatisfiesMVCCBatch() can also be called during logical decoding - in > that case we need to use a historic MVCC snapshot. Huh. Indeed. That's unintentional - the path should never have been reached, we are checking that an MVCC snapshot is used. Unfortunately, somebody (i.e. probably me) at some point defined the relevant macro as /* This macro encodes the knowledge of which snapshots are MVCC-safe */ #define IsMVCCSnapshot(snapshot) \ ((snapshot)->snapshot_type == SNAPSHOT_MVCC || \ (snapshot)->snapshot_type == SNAPSHOT_HISTORIC_MVCC) Which makes sense for some places, but not for plenty others. The reason this didn't cause more widespread issues is that during logical decoding we mostly don't use sequential scans etc that are affected by the these paths. > My proposal to fix the problem is attached. That's imo not at all the right fix - it'd make visibility during seqscans checking noticeably slower. I think we ought to instead restrict the page-at-a-time scans to only happen with "real" mvcc snapshots. I.e. this: /* * Disable page-at-a-time mode if it's not a MVCC-safe snapshot. */ if (!(snapshot && IsMVCCSnapshot(snapshot))) scan->rs_base.rs_flags &= ~SO_ALLOW_PAGEMODE; should trigger for historic snapshots as well. Does that fix the issue for you? What's your reproducer? Greetings, Andres Freund