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 1xJ4Tx-0000000439i-0jy2 for pgsql-bugs@arkaria.postgresql.org; Tue, 20 Oct 2026 07:42:01 +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 1xJ4Tw-0000000BEuX-0qjg for pgsql-bugs@arkaria.postgresql.org; Tue, 20 Oct 2026 07:42:00 +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 1xJ4Tv-0000000BEuH-3kaZ for pgsql-bugs@lists.postgresql.org; Tue, 20 Oct 2026 07:41:59 +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 1xJ4Tt-0000000376V-1nG5 for pgsql-bugs@lists.postgresql.org; Tue, 20 Oct 2026 07:41:59 +0000 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id 219121D00145 for ; Tue, 20 Oct 2026 03:41:55 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Tue, 20 Oct 2026 03:41:55 -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=1792482114; x=1792568514; bh=VBJ5DV5P+l mn7hnfQNZf40Di+c4pEEHFJ4V/+tjxT+4=; b=VhgsjrO56qAnYmxwvSnZm/icMK gm0y14jYpt1ieb1fknuVVh6TkL+jckM16bE86VH/97oVJwjTPC865f3v4nc8AE07 XSU6vRXdPuT/oq4wHh1B7osI/rLMKDYTIOVZTNCavi1i/gPwyyQeWpMpeesVkEEp oe5Y4z3Uhcgq9qsQlCsOXRSw+T8VJaiE19fxrI6EBpQ174tpArvwzelKX7lVCF5A oZZgqAOfN3fK1OM/2L6EVhNs3NfF+1Tb+2RpgzpkCJMEX+fatTDFjfW+Ttr0uNOR XmZSqPhiL10gXTRYlxJZf7UO0dhfqDKVNal168e2DOjyZMMcgnMhxivydjIA== 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= 1792482114; x=1792568514; bh=VBJ5DV5P+lmn7hnfQNZf40Di+c4pEEHFJ4V /+tjxT+4=; b=BrzKfW4yReMUcrQc8aheK5/x/c1sjZ5+OfXz+hUf2k59DH0EmGr wUwdezZdHoaQv3CEa/sxBb1rpAHp4AOecNL8mq0/ps0GxqaeUe/9FS5mLxFt3hWI 3caDE4ks0n97tFrSAc+D9le3B0zV4ZvnNWsjFatDVzGu6fdBQCpJ1xnebZqwRAB1 7LrgEuw9UmoftdtMsi1v6OWUupbV6043H6++4WN4v0nBdtBtcBDePVTYSYy6bxmw B3P+N8EMjfL5s25Nm3Po2QAMmniF5vCkbhuhqqzEpeZ2cYX1DIHFqT8+XI25XgsM DSBGJlaCNvVGQMLyfrP+XhalZKttZA32qxQ== 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=1792482114; d=paquier.xyz; mf=PG1pY2hhZWxAcGFxdWllci54eXo+; rt=PHBnc3FsLWJ1Z3NAbGlzdHMucG9zdGdyZXNxbC5vcmc+; s=fm2:rsa-sha256:haqHOK125hyp5ihCaYkBiwl4mZIslX9QjxQ2UHJTLxPSJTl LGX/6lw0hLSPEKiOOnSFWckrPSYLhSVm87WONkhH76dN2YkyNXpycFK1yXEVeDkp fFA32IjZWL/J6oBAtVWKOOnbe2evGto3YSG64NqtRNMvw1wrAGi2Va0M+pW+FrDe XF5pc9ngIX1+NJPWvx4WPoFC/Va5aPqsRA4emCCh7bz3SrBejnRzUOq0Rp3ig5P9 zOHHRUqaWWRRL57QiUiGHUP0WuPwP1iMcikAqoDU/FpY8F853x9rRlnTZVvJGa2a OdAKO5NPDqDaFI8yrpRqYKsVRg32j3nXEr50W/A==; 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:Og5s07A1AaU4azGEItLfZ4Tfl1CjXULtyl8Ty9gLJVY=:mLlPqz9jRgeel65TMouiigJX1Al+j+memmcdqoCQrHg=; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTFdZCZY+jKftJkr3gJj+PbNeMR9a1kWLs0GuNVFaevOAWN+J6oMXTLGIgojcNzyJd ofCwO0sSppjGA/8iRSvsRb3NvCIpIP/IPBhWnlh3pdE+c3ZrRawgrrIp3+yOWz1srRTCNH PpEbavqHi7YcYUCjDCxW3A36U48zyoc5qjlx6Ze1dRd3AhO2/G+57m7OqNiUZ0rh93PrfG u+aTp0oRhRhylUP1xryA87Hgjpl3TJ89GRA2BMszSG7RuT2F63SYE/c0C8r8lzR8+cEIYv NqXlt73LQCzFcoPmuG4aCuVZv0l7cKjY1JZNaSxO1Ll/mhl07hVHMRIcgRtiluLSgUrXGw zYms7KLDaCYxf/BDH3bxfzRCwoNqQ4emUzBZl/BvDAGKBO4/EA6MpLOKJOqOF1JuxSq4uK +uz4S8HXYmRB6mcN57/S040dks/YUd2mJjquVvOIvCTU90rMEbbiu+go692GVsGuF5zhq1 0Rrp31yIoqc96ymAvkr6SO8J75k5XorlpZK7POAGrnwmw6yA2toHCb1lGpdfOPc6rmS0+k /OmgxDBEbM/moPDWXe3ZdXku967y7QZBKxDCX8kn+ErQOijHpZPeoamyP2ahFyvFIxLUvz mq+CXfTviLbc2zjSp9E1h2+X9Hn1LDEu08lL9fb/DemVJTNx8rYrD4ek9USw X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 20 Oct 2026 03:41:52 -0400 (EDT) Date: Tue, 20 Oct 2026 16:41:49 +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="BCLxDRFgkirs1xEm" Content-Disposition: inline In-Reply-To: <949ad7b3-2b0e-40dc-b6ac-e84da432149b@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --BCLxDRFgkirs1xEm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 20, 2026 at 11:32:44AM +0900, Takeshi Ideriha wrote: > Regarding logical_rewrite_heap_tuple() part, you are completely right. I > tested by myself yesterday and hit the same error while decoding the > vacuum full scenario. Thank you for pointing out. I was not aware of DDL > case with logical replication. @@ -574,6 +576,14 @@ rewrite_heap_dead_tuple(RewriteState state, HeapTuple = old_tuple) =20 if (unresolved !=3D NULL) { + /* + * If the inserter of this tuple aborted, the update never happened + * and the earlier tuple is not dead. It will be written at the end. + */ + if (!HeapTupleHeaderXminCommitted(old_tuple->t_data) && + !TransactionIdDidCommit(HeapTupleHeaderGetXmin(old_tuple->t_data))) + return false; 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. -- Michael --BCLxDRFgkirs1xEm Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmrXGz0ACgkQnvQgOdby QH2CDRAAh5sjMxOXOqO2J49RQGYhyIes6QdIrPDZDXEwJ/QlxXDA/D30rxpvg5iI vEEJ3XZhD+43AwrORtmcWur134/ZLvGLP8qOveMS4nLKxYi1qy+UwPSuKto7fgqm 30T9v3XumngMv+7XXm1P5FvozOuoljYebHVdt8tsKZMkr5JAcN+EljeamQDCkIpa eXGfqV6veAmcT8MI5aMDJquJ6qnHljdI7Fp5jkNNBkfe4kMl8GNuUF+jGCb+nyHj IKhCTa6wptCbLjMDIjiGBRiFbhk5Y314bUn4g8j+KZ4SOgRH4Ujpo+ND9iUfJ3SP 0xfN+qcRdhhs25iCSOKz2QE5g57HGTO8j60g0SJjkDu4O04vBUfn4w+LyFkVE/F0 fCzZ2YEZ9IxSAY4Z8M8VMTGO3t8VFvKIxzc4rsmpzFO8iHmoA7KfEVUwwK7zlYpe 5XBk87MMUzcu4mqirQyZpbRA94o9MdM9T7ae7xyIFt88Oke1UC6spwUexs417vXz Wuxl6BsoHCvY9xETFZ/7dURX0d8tnJ4gSBWAK6pRywDhd8d2zwQ3qV9ofBKDEwVM kAY87PC2ZklkVrT2d0yJ9iEQmjTOunhgS1US1bZaq0mQ1ICGL59R90duQpokjjn8 HYnhbn2IlHSe1XGMso35j6akNHoz+J0hpkwxGwThGwwbq02GVGk= =EWpk -----END PGP SIGNATURE----- --BCLxDRFgkirs1xEm--