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.98.2) (envelope-from ) id 1xJ4gB-000000043Ih-2Nie for pgsql-bugs@arkaria.postgresql.org; Tue, 20 Oct 2026 07:54:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xJ4gA-0000000BIEG-2DPQ for pgsql-bugs@arkaria.postgresql.org; Tue, 20 Oct 2026 07:54:38 +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.98.2) (envelope-from ) id 1xJ4gA-0000000BIE8-1AoT for pgsql-bugs@lists.postgresql.org; Tue, 20 Oct 2026 07:54:38 +0000 Received: from fout-b7-smtp.messagingengine.com ([202.12.124.150]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xJ4g7-000000037DB-4Ak0 for pgsql-bugs@lists.postgresql.org; Tue, 20 Oct 2026 07:54:37 +0000 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id B1C9C1D0015E for ; Tue, 20 Oct 2026 03:54:34 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Tue, 20 Oct 2026 03:54:34 -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=1792482873; x=1792569273; bh=1P+OpSpURQ /a9WV2h1Son+Nz87yMZkaZb1IEn0pkQ88=; b=Y/DkVTOnjEChUY0uUj2NEAFIz+ C1DG/XJRucO2wiHol+SFCA5EMDljR0Arc3jjCPSHseiRVxgF3m0Cjgwf6ylgYn+v rvUbCtAZPA6q3wRfs0ArtIyEzlQfm5FX14jIv7HA9oqvpWSWzjKWQVQBWChBOo5u Ro3MxSIkkxPPOCX3l0y4w6Q0wF9SCT+yaqKDFd3zY9pHRsazTRzw8XUZO7HvGie4 9OalVo4O2HBX1G1QrJfrgeEZUYLSVTQymhUd1CqbP1vx4zqyry0QMc1KDNz7pbH/ TP2kgwRjwYU1u2Tm3sOu+IVmVDDGEy++yPelUJemBHQ4kOrj2FqCnkPIpW4Q== 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= 1792482873; x=1792569273; bh=1P+OpSpURQ/a9WV2h1Son+Nz87yMZkaZb1I En0pkQ88=; b=YQHACe5iI03etP3XCySjy67TyLBhuE2cL/P3WU0xdwCgxnlZf19 6yINlvEwixjMGvd3JynyeXujD6VboFZAHqKrYRCdUzAaiKw0ksKkPLut/ObhDBkD wWwyko2YQoOCzfpVyjSBWiJpWQyt6r0jDzL+8GWwf+jIamhC+pX7UeMHBfPMOj8R b9V2OqGluw7tsBdN8tvaY5Rq9OqG+/E2c5kHl0jnrurQcuGhZ5dEF5Z6mfUlR95d VIXmQpA8Q7O9xg8ebkLXmo8yFvgvhpLMz3H7sye0Po0rcWpCD9asLfAbbYpeO8rK lvt14uQBMGOVbHp94kCNTDkGgSukxZbGpTA== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-06; repo=github.com/dkim2wg/interop; date=2026-10-08; sw=lmtpprox; action=sign d=paquier.xyz a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1792482873; d=paquier.xyz; mf=PG1pY2hhZWxAcGFxdWllci54eXo+; rt=PHBnc3FsLWJ1Z3NAbGlzdHMucG9zdGdyZXNxbC5vcmc+; s=fm2:rsa-sha256:sjwzPTfkvjhCFpDKVaug7+GGiYDmK2O8fjc6db23zw7MIR+ t6iFHZqLou2OpxKhZJCHm6IVFYoGj8p4t3yHrWXlAOV/0Z+jrDWhnuTBZEKHLPxm OSi6BpqicpaohsoPf8fFjrwoW1KJotwBfMBmU7Htf1dvcC4Y1g3r9LQWXoPk4mPL y7Lchl/9lHcrsc7OSHCBwQIpcEpPzoxtO0+vSwe3J0bmpcex82RKMUtNA+53+obk 8xj1p5OqburqHP1vDhN8KjAUlFIchGua9cKciExuzOtjuIRl8dFgvD/8AoF6bxkr jGxOfFkXA9G2TM8jkzCY4tG6tChkwVCjzR1rbXw==; X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-06; repo=github.com/dkim2wg/interop; date=2026-10-08; sw=lmtpprox; action=mi-m=1; hc=12; hn=cc,content-disposition,content-type,date,feedback-id,from, in-reply-to,message-id,mime-version,references,subject,to; Message-Instance: m=1; h=sha256:URu7WVZhLcttLhBeEPLFGhtTDcZIKZqFeLCjkf+Qj10=:sOE4WFAquGXa0HlZRQ3HYf8xa52Z39jmyPtZRvOthFM=; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTGo5La4AiuDeJ+sxveajhz2zbcvyQ2rUgQCYFBWTTvtdRmIBnrFbc8zJDDhVlHkde ZtLPHXftrdPaJQvDW2ykN0so0iUd0tcxIoIWw9KIT9xMMbJr8TDLomEadXC4M/4jPi2Cxl GFFSAUWOZCSU5yLu0O03EFFpMqZBahfrZAoZW6F3rtWTm14/ByfSGkoyz0RK8HXIXp7Qdi B9D+3fUQrVBH+eMYfYHBbqw4CE9M6EC8VH0p/IWHWqmj3ykRt44rL86J4IuFTp2wZ0xi40 +YFqR/Mt8gO9W3eXNPsGAflxGjozEPOchvmWR/yQHIER16JusCIDMw/Iw47kDbE2jn3kDl 7W0dKquF61pmPuSMkhObSwPofaD1XpJXMYwPziRf8C+k0UIQWH+jXiYcOQ+Hx2dNEGpH9S Itz+6gdjStpW2IrEf4OdbtSPWDkd5dm+LZRWZwduygiJ29bd7iHpDro1u0uYGLgu7jzr74 Gh+CT+gSYdyY5KwDvIej/5x/TCXplD4UiGufdAt4BGjZnmPGn6NqvVBQzKU9eA+pxg0+Ut +SjLZUyRSUl52cPdZlj3pRFbC9g9WsPDsyp3vktfTzwXsrlH9j35NIzWClw1svByIoCS4A XAxzE0zqHsFcL2TDCgclkeL9jdBvl+k0sLn6CuDzRHVYK9oz42huK2WjlmpQ X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 20 Oct 2026 03:54:32 -0400 (EDT) Date: Tue, 20 Oct 2026 16:54:30 +0900 From: Michael Paquier To: Takeshi Ideriha Cc: shihao zhong , Ayush Tiwari , alpkeles99@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19760: CLUSTER loses a row the transaction inserted and then updated in a rolled-back subtransaction Message-ID: References: <19760-8f9a0eba17bc8c92@postgresql.org> <41175da6-293f-4b8f-ad18-3636f3d8a2f6@gmail.com> <5fff280b-96c4-497f-bbfc-0af95b9844b3@gmail.com> <949ad7b3-2b0e-40dc-b6ac-e84da432149b@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="0gix0M9kRmAUv5/d" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0gix0M9kRmAUv5/d Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Oct 20, 2026 at 04:41:49PM +0900, Michael Paquier wrote: > Having a recheck of the old tuple's state within > rewrite_heap_dead_tuple() feels very incorrect to me, based on the > bunch of comments at the top of rewriteheap.c. It sounds to me that > rewrite_heap_dead_tuple() should be called when we know that the tuple > is dead, no? Isn't heapam_relation_copy_for_cluster() the bit actually > incorrect here, marking the tuple with "isdead" to start with? Your > solution of a recheck to make sure that an old tuple is actually dead > in a code path where an old tuple is assumed to be absolutely and > definitely dead looks like an API contract violation regarding > rewriteheap.c. Looking a bit more at that before the end of the day, I think that the suggestion of touching HeapTupleSatisfiesVacuumHorizon() and setting some hint bits would be the correct thing to do. One case that matters is the "deleting subtransaction must have aborted" case. I am pretty sure that we should also worry about the case where we check for TransactionIdIsInProgress(HeapTupleHeaderGetRawXmin(tuple)), which looks reachable, and set an extra hint bit there.. -- Michael --0gix0M9kRmAUv5/d Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmrXHjYACgkQnvQgOdby QH028g/+IuMa6UzBDsLemKuxzmg+8U+KcTUBvqZr637ngAB6S74DgwzZ2guauEqn g4AhOjYKQRwfI6VFKflfkrNISI7XMKbXcL31dpsBnAtR6HpfKq4PcXBbQmsvVM20 yGbJ0sRyZv4MqlwhPiUnEs6XFhKpTmhebxTb0G1PCpzl8V5ZJ+KCTg+aOm6kuIZx gBUIQvcHQs7kz2h3qIeA7wFsngj4WiCB0O5ivtXlXvVFLEAemnBvYyRIY6zx/VA8 tw2MzKEL2gDjWdVlyqJLWeTojdbZMas/Nvheoz17aSMS5HYP4uxjR81r+uOPZVp6 KcuM1IaUWco62z39z+SHmGiBEsPpkTXz2UAFubNgjDF8ll1GwS84GG5J6vaHBTzc okHpNwQ8TGZcRQ+dVyHCvqeXHamYFkdu5YKCcHg9GszPbtXih2xKUNW2/ACdj6hd CDnZplqikvRBtUzCaQw5s9kbvL6F1cKVVti9g4Gs1rbihLMxSqa6pmk18FC/aVWX xc+qR0XsDGitf4oxUUmuxUoUf/U6L1kFy6su5P8GiuVu99d/68w5AEOKCPVLI5B6 LYj8wFuScsp6TT3UVvEFY7TAKvhgUN4okxnvkFR82ORLC0h7fILRCKiK/yeMJ4kn lHJ63COv4rD+Kh+Ajgj2iQ14MFWsdN38Wrb7Lt3+Y09tFbgLXH8= =uusV -----END PGP SIGNATURE----- --0gix0M9kRmAUv5/d--