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 1xFF4V-00000001VAl-2fqg for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Oct 2026 18:11:56 +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 1xFF4U-00000000saM-13xu for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Oct 2026 18:11:54 +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.98.2) (envelope-from ) id 1xFF4T-00000000saD-1Xyg for pgsql-hackers@lists.postgresql.org; Fri, 09 Oct 2026 18:11:53 +0000 Received: from fhigh-b4-smtp.messagingengine.com ([202.12.124.155]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xFF4R-00000001CWr-19ha for pgsql-hackers@lists.postgresql.org; Fri, 09 Oct 2026 18:11:52 +0000 Received: from ams-compute-02.internal (ams-compute-02.internal [10.64.2.62]) by mailfhigh.stl.internal (Postfix) with ESMTP id 95D6E7A00DD for ; Fri, 9 Oct 2026 14:11:49 -0400 (EDT) Received: from ams-imap-09 ([10.64.2.29]) by ams-compute-02.internal (MEProxy); Fri, 09 Oct 2026 14:11:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kurilemu.de; h= cc:cc:content-transfer-encoding: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=1791569504; x=1791655904; bh=XyGhxRNar6Yr6ImzYONTZNYGEc3dXU4QJpE64W+j+zk=; b= cEayPCzJBFCUFGKkNreV+kw1+AO3ddVeMUnjF925K+P6S2cdvHQIW2NQAVqYHY0U UdduYlziXySXYHZrHxps7oBIoCmzTBGsvHFa3pPAe9gdrIjuWZz2jz4sN87RSxjx CGkNa/6Sdh8YsD43WN2ECx6+fdgJJIIkR3Szw54dTjvZASBuCO5HUybsbvoIi0jW qzZTCYhERycb2FkGEnR3F2PjrvMGIubY6bA0eCMMUIw5moQex7/U0Mty2HCKmgi4 ON143eQmeP3qV33L5oj47XY2qIKn8HIcX3ZwW8hPNX5mxt9ejP+1jiJ8VrgM6aVl ohqt5JsqKX99UtE4CO8UNA== 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 :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1791569504; x= 1791655904; bh=XyGhxRNar6Yr6ImzYONTZNYGEc3dXU4QJpE64W+j+zk=; b=r DTVZbkt+l+SK2ExnNtI6EzcDRii0H3CEr3aRxrTMUFUIlnWFenC4BrLFzP53gE3b 8eQjfEr2y5ch/xIFpMzfb5OSUd4HBCrd/04FXHZAb2bNmbaSY2zYmtObz8698Ieu M9Vf1JLjBrsR/Bomq2IzjdOfMiJkinu7O/MTaRM2phZhAjeWqFnWajwucwQb2SjV pTpljzEQ+vj61F+NfxFxRbOcZ9Pc1nnEoRmnVVcItwRzOg9xNRsUQF1aPt0WeHIA kzhNOPrazSIGKPnVmswzqZnOiYNTyBUTayIpHTFjjGPy9cgNW2o2pcZZXoDMBCZs ORCUujvLJkOkjnC2gEaXg== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-06; repo=github.com/dkim2wg/interop; date=2026-10-04; sw=lmtpprox; action=sign d=kurilemu.de a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1791569504; d=kurilemu.de; mf=PGFsdmhlcnJlQGt1cmlsZW11LmRlPg==; rt=PHBnc3FsLWhhY2tlcnNAbGlzdHMucG9zdGdyZXNxbC5vcmc+; s=fm3:rsa-sha256:Xo16EUEzwQ7ZaISLMXwJTCWlCMOQLU8dS4/I5mvYb3iuWFL ggqEhiuHB81oZi4NNQQ0a/g6NY9obC/zJvr3M3tS6j8lM7gwXjsR5sBb8kYTqls8 yUDxbHF4dGhDRiMheSKz5EMWTzWLKKc52QZzxhZQYacVoYmORVBVsbYnCKbzv0P/ Fb5xLjR5Vs9+0UzWSi3JFaxONgPDGJMR+hCARgQOOjKzWS2OcDuHAGUnPf0MwJWu 4DtS7BdiiI8PZfPuUOQmOAHlgEu/b+4HWml6e2VmfsLOf76ZobMLFbk5kSYipJDz BN/ImDa/mDN4gRQ8I/b3yacj7m0ARuZP7X45jTg==; X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-06; repo=github.com/dkim2wg/interop; date=2026-10-04; sw=lmtpprox; action=mi-m=1; hc=12; hn=cc,content-transfer-encoding,content-type,date,feedback-id, from,in-reply-to,message-id,mime-version,references,subject,to; Message-Instance: m=1; h=sha256:4dJVSGymh9oamsLWjLM100OUIWtuAigXij/Fz/3u/8s=:q6RQRakDlE2TVYB55xmc1i+CaH8cL3otgTUEJoKoANo=; X-ME-Sender: X-ME-Proxy-Cause: dmFkZTFf23WeT2srnDVxiQF5O+sgGEO3m94Qtc6CxSJL8bZ8lhiH0GiNivF5fFYy0MLUR4 fBGT+V746PU0nQYD6zKeYRPLyyTctslIAdHP4ZVPuPQCMF3+2+8nwKktEMMmzgyYrKMEHo pvYO1zsohAx0POYFF3Qily2O8AJ6ER+WSGbqr1rzmmu7lxW+2zDFUkHNZHEzOxMlmTJlPs SLz7Su0Hw0Fn3d/VToYbT54jebJIXsOUB2aAkoft287goeMwP1YzIE5boQfLzoC/cb5I3Y Oed2podBprciDJUn2s5GiLXnbT+8syuX2dtj7Ua69Mfa/GfWpq0S0pJBN1re0nSte6w8JI PI0+KnvR39FBebcaWyxKCRoi9TfYFyqe6dmE5Vv4lGK4QeIFdHAoMkSEgPYkPceP9zLUUn tmrYdK8MZ6IpH48MyS2o2ALeqv+Hr645QX7PbkDkB5xOow82lU7zng9LDJTnXYZPTrxH1X MgESgMJBZhAr+uD5MRCVvFUbgZgprqNS7XQcvwpumAln59DZuORNxotTyu3tcw717x1Z8t i2hKND7dU1Ooznvt5rDTnNKhcMaiVO7Aqa3om8/JHKWzrFsi8k58Rx8Z3lkxSPVR4YGVLU W3sltrUNzwefR6UdYH+INm+b2LdSnK+s05WXajlGzobk5pzb8kCFTmanWgWg X-ME-Proxy: Feedback-ID: ie3de48e3:Fastmail Received: by mailuser.ams.internal (Postfix, from userid 501) id 6FA32180088; Fri, 9 Oct 2026 14:11:38 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 Date: Fri, 09 Oct 2026 20:11:18 +0200 From: =?UTF-8?Q?=C3=81lvaro_Herrera?= To: "Zhijie Hou" , "Bingshuai Li" Cc: "kuroda.hayato@fujitsu.com" , "Michael Paquier" , "Tom Lane" , "Alexander Lakhin" , "L. pgsql-hackers" , "mark.dilger@enterprisedb.com" , "Amit Kapila" , "Masahiko Sawada" , "Andrey Rachitskiy" , "a.kozhemyakin@postgrespro.ru" Message-Id: <57137b0d-dad2-41d0-8f5e-8c99199e67a2@app.fastmail.com> In-Reply-To: References: Subject: Re: Bug in logical decoding with DDL and subtransactions Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2026-10-09, Zhijie Hou wrote: > Thanks for the explanation. I re-read the code and comments and have s= ome > suggestions to simplify the code and improve some comments. I think we= can > reduce the code in Kuroda-san's patch with a simpler loop: > > txn =3D ReorderBufferTXNByXid(rb, xid, false, NULL, InvalidXLogRecPtr, > false); > > for (int i =3D 0; txn =3D=3D NULL && i < nsubxacts; i++) > txn =3D ReorderBufferTXNByXid(rb, subxacts[i], false, NULL, > InvalidXLogRecPtr, false); > > followed by a single early return covering all the skip cases: > > if (txn =3D=3D NULL || !rbtxn_is_known_subxact(txn)) > return; > > I think this makes the code cleaner and shorter, and also fixes the BF= failure > IIUC. > > I also rewrote some of the comments above > ReorderBufferCleanupAbortedSubTxnTupleCids(), using wording that's more > consistent with the rest of the codebase and simplifying the explanati= on of > logic that isn't directly related, hoping it reads better. Hmm I had already made essentially the same changes locally plus a few o= thers. I'll share my patches over the weekend. --=20 =C3=81lvaro Herrera