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 1wgsak-006TIn-09 for pgsql-bugs@arkaria.postgresql.org; Mon, 06 Jul 2026 23:19:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wgsah-003cm9-1h for pgsql-bugs@arkaria.postgresql.org; Mon, 06 Jul 2026 23:19:07 +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 1wgsah-003cm1-0u for pgsql-bugs@lists.postgresql.org; Mon, 06 Jul 2026 23:19:07 +0000 Received: from fhigh-b1-smtp.messagingengine.com ([202.12.124.152]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wgsac-00000001vHJ-2sgE for pgsql-bugs@lists.postgresql.org; Mon, 06 Jul 2026 23:19:06 +0000 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.stl.internal (Postfix) with ESMTP id 8A1997A01CF; Mon, 6 Jul 2026 19:19:01 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Mon, 06 Jul 2026 19:19:01 -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=fm2; t=1783379941; x=1783466341; bh=9Fr0+oti/e Vpzi2qSXIuicEk4ONbbkN720JRsBIB1Lk=; b=WxFWvkDOh/M3F83ogAlml3RX0Z FpBEgb83AUQH5BUgeNAoQA52I6pC7pukFKxJtPRD0I4tox6vymtlsI8h5ZSIMO2D UcB0hzxjioKh2hiI07esU7jlT5MhG9BkskC5OIrxKk6eReWoM0EFXe7wNaT2rurI cetHRU7sJXC7+nxer8j70atyl2AUA2gXhHC+5sADiLedE3b+sFJBGbiOuzgKed5J Kv5zz1x4qgve3TIAQAfcGxAyyigPFhgydOZ6Av66jS6eZPXA/fCCuftt4aqUQWj1 B//tG73i0RoxER8E9VtNDsfmhzXCurxwuxUwIKNOqq3KfRReu3NAoeo09wCQ== 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=fm2; t= 1783379941; x=1783466341; bh=9Fr0+oti/eVpzi2qSXIuicEk4ONbbkN720J RsBIB1Lk=; b=ksu5LPtxB8hUYTeWahs7Y5w/1M7RZ/QHQsJXOaOrzs8ND7XepaV 3qnHrzbde8SiY3EpcavqSHTWUU+npgrZyvg/CuQE6w91bdhTkI31dBlNd4l1ddge YMMcrE/4aeUd6f63FPrVsbsrFou2px+MF9UO1QQBfXrIC/ggKnTVIAGf/2Ay73Nt hAacjmWbRfYCfDoLyNO+HK5sclwKKuZUQKkB9WdXm+ciXLbqHkGvqA9vUaGHnI5X O3UA1syz8KaffYk5AY3JUClR6HYeFYrD+nZmwE83hifMZ0nSGKLAmxz4Ows+Vf6R 53xNQukUCNcTQJfIIGyx69HfNfXByJghtfQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTF1SnvwEowHGN/VWSP8hHkw099Z00qYOa83gCbIL+r4TLyyuRsaGPAmC6KCNhnrZY qGUqjyFu7npAAz3aQSPa8xbRFY4kBF/Zru/W6F62XZqKpuAmgeyMVgWMWMN8XfYxxpeBzO upCrwj+wIeOqlNvMQOkLjAiGZOP3clo0kQzwsWEaB5jIdCr0n+w+pDVx/us5DcSlMn16RW b3FTGykt8XKMj6e4HCLtI/DwyCl1b+ZvqrY0D8VVdfm94T93tLRIM+/53F2OAAxun5fe2b 62MQs4o8yrTFLWgD00cFcsd8t6roiYdNlruCssi/M+SDyoZsJbhvvSTVJ+715K9WMAXScb et9TcROVOG92LyqealK6sGoOxwF31cDMc9slwxmq89Hs/Yih51K4fPrLT1oKxPf81kA6eX VJU7pCA/vBxEUqGoN1803XQyj2x8iDMWeG8MqbJOsbmKVrwyL1ubhKQTKzV4P6tvRrFAjr QKjITFliHPUhuKqLgpoVpwy3R+7I0hjRosLvC+A3uqYOhBAkhhw3SfMWpb8Qy0hyrEBWmA FIEQav9b5wqtdR90ZqozWLKIrXgwL8/mQzswCyBhByUcAOTQUxoPhD6gouSBzXQi8kYL2t 69xbXDquVCRdclnOG8w8X4qkDCt4aWsukq1zq2sLk5PP8rxHIvhlTipsXFHQ X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 6 Jul 2026 19:18:58 -0400 (EDT) Date: Tue, 7 Jul 2026 08:18:55 +0900 From: Michael Paquier To: Matthias van de Meent Cc: Imran Zaheer , Srinath Reddy Sadipiralla , exclusion@gmail.com, pgsql-bugs@lists.postgresql.org, Konstantin Knizhnik Subject: Re: BUG #19519: REPACK can fail due to missing chunk for toast value Message-ID: References: <19519-fe02d8ff679d834d@postgresql.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="j0tAE/LCknK6Cl8z" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --j0tAE/LCknK6Cl8z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jul 06, 2026 at 08:21:41PM +0200, Matthias van de Meent wrote: > So, in effect, this is an issue that's quite similar to the CIC/RIC > bug of PG14<14.4, except that > > 1.) in this case it's SnapshotAny instead of a > registered-but-invisible MVCC snapshot; > 2.) the issue in this case only happens when toast pointers were > cleaned up and then are dereferenced, rather than HOT chains updated > and reclaimed since the scan started; and finally > 3.) this issue dates back a very long time, likely since TOAST, but > defininitely since PG14 introduced the GlobalVisTestFor apis. You mean 042b584c7f7d, revert of d9d076222f5b. That rings a bell. > So I think the only way to fix this is either > 1.) we update every maintenance process that makes use of SnapshotAny > and could access TOAST tables to handle errors caused by missing TOAST > data when the base relation's tuple is RECENTLY_DEAD, and treat those > as "tuple cleanup has already started, we just weren't aware of it > yet, so ignore this tuple" (as I mentioned in [1]), or That seems like an option worth exploring to me, but I doubt that we'll be able to get something that can be backpatched due to how invasive it is. I strongly suspect that it would require at least one table AM change to cope with the fact that we want to let the callers be OK with TOAST chunks missing in some contexts when grabbing a toast slice. That's perhaps for the best if we think about potential regressions, this is scary and old enough that we may still be OK by living without a backpatch. > 2.) we set the xmin of the CI/R backend to the current OldestXmin for > the relation(s) we're currently processing, and so block all cleanup > of the relevant (toast) data for the duration of this statement or > whenever we check for a newer xmin for the relation (whilst ignoring > our current one). Err, I don't think that would be safe anyway? It's rather uncommon in practice in schemas, but we could trigger function calls, like index expressions, domains, whatever, that access data of other tables while processing one table with a SnapshotAny. The CIC revert of 14.4 was about such cases. -- Michael --j0tAE/LCknK6Cl8z Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmpMN98ACgkQnvQgOdby QH0NXxAAk1cvcrSYkAnLWW16K3B9MHaG3uQiEPq31c+PxW410xO4897sEkRcDwHq yMXBFjKtdakBAmmpehuAXFhj1qXisVJuMupMf1WFwe6V3NSXrLl3wMJjeuhmksgC thHyNbPdK+HscIMpjqBJaK86l19h6tKC1wCs31jVKKgSm3OlKtCuPICVXpviBYE7 o/NTd8JJYugAZ9YiKT9I1s6dUeoeUbHBq4yYX3YmibFLxc8fMzhh+NHy+jYYp76b aoJDi9C8P81SPc/5PGy4qi06lYfuDvBdELVDWKjaM98a5jk2nPqIxQoQUfoJEoUh rlKMFK/Ld287GrHp1vmT5qOktyVDb+bpXj8XBREb62ZwDLoK1wFZGf3q2DhNaDQv 1lq/f3J8UEVPBQ4L7xUayEa7XLneSDQwcsSiTTA/qhrxszSoF1bDnK1cIsOH+O32 Qa2T/qiZzoV+YjgWRBNWV3GN7ZFo/UYf633DoIo3X5we6+18B9/VyIRnRW5AfKD9 I+K0ImvMqSyPmjqqPhIPJmUfmwTc11fxwJqoQ/CLAf8xeKUEzfDGL8PKly7IOCH1 KUTWjJ/G54H+BMXPtPq201jyQhJ00Dwze/B7r0dY9nrjtEPv4CRYE7si6ZHU1O2o t3e2vGsya8gAyVP3HHEThEOpM9QWKXrQ79RkMRSAraMsVA0GHZQ= =4Uqu -----END PGP SIGNATURE----- --j0tAE/LCknK6Cl8z--