pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Álvaro Herrera <alvherre@kurilemu.de>
To: Zhijie Hou <houzhijie22@gmail.com>
To: Bingshuai Li <lucian1412@outlook.com>
Cc: kuroda.hayato@fujitsu.com <kuroda.hayato@fujitsu.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alexander Lakhin <exclusion@gmail.com>
Cc: L. pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Cc: mark.dilger@enterprisedb.com <mark.dilger@enterprisedb.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Andrey Rachitskiy <pl0h0yp1@gmail.com>
Cc: a.kozhemyakin@postgrespro.ru <a.kozhemyakin@postgrespro.ru>
Subject: Re: Bug in logical decoding with DDL and subtransactions
Date: Fri, 09 Oct 2026 20:11:18 +0200
Message-ID: <57137b0d-dad2-41d0-8f5e-8c99199e67a2@app.fastmail.com> (raw)
In-Reply-To: <CAFvd2n-AOLbEhVL=BiHx479VMAvFzoyHG__vet1bhvkAA3pmMQ@mail.gmail.com>
References: <asYjDLP46AjRjzpP@alvherre.pgsql>
	<asZPa_bVpP7yCVr5@alvherre.pgsql>
	<ME0P300MB095324292D91BD61022EBCF9C6932@ME0P300MB0953.AUSP300.PROD.OUTLOOK.COM>
	<CAFvd2n-AOLbEhVL=BiHx479VMAvFzoyHG__vet1bhvkAA3pmMQ@mail.gmail.com>

On 2026-10-09, Zhijie Hou wrote:

> Thanks for the explanation. I re-read the code and comments and have some
> 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 = ReorderBufferTXNByXid(rb, xid, false, NULL, InvalidXLogRecPtr,
>     false);
>
> for (int i = 0; txn == NULL && i < nsubxacts; i++)
>     txn = ReorderBufferTXNByXid(rb, subxacts[i], false, NULL,
>              InvalidXLogRecPtr, false);
>
> followed by a single early return covering all the skip cases:
>
> if (txn == 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 explanation of
> logic that isn't directly related, hoping it reads better.

Hmm I had already made essentially the same changes locally plus a few others. I'll share my patches over the weekend.

-- 
Álvaro Herrera






view thread (53+ messages)  latest in thread

Message-ID: <57137b0d-dad2-41d0-8f5e-8c99199e67a2@app.fastmail.com>
Permalink:  ../57137b0d-dad2-41d0-8f5e-8c99199e67a2@app.fastmail.com/
Also on:    postgresql.org/message-id/57137b0d-dad2-41d0-8f5e-8c99199e67a2@app.fastmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@kurilemu.de, houzhijie22@gmail.com, lucian1412@outlook.com, kuroda.hayato@fujitsu.com, michael@paquier.xyz, tgl@sss.pgh.pa.us, exclusion@gmail.com, mark.dilger@enterprisedb.com, amit.kapila16@gmail.com, sawada.mshk@gmail.com, pl0h0yp1@gmail.com, a.kozhemyakin@postgrespro.ru
  Subject: Re: Bug in logical decoding with DDL and subtransactions
  In-Reply-To: <57137b0d-dad2-41d0-8f5e-8c99199e67a2@app.fastmail.com>
  References: <asYjDLP46AjRjzpP@alvherre.pgsql> <asZPa_bVpP7yCVr5@alvherre.pgsql> <ME0P300MB095324292D91BD61022EBCF9C6932@ME0P300MB0953.AUSP300.PROD.OUTLOOK.COM> <CAFvd2n-AOLbEhVL=BiHx479VMAvFzoyHG__vet1bhvkAA3pmMQ@mail.gmail.com> <57137b0d-dad2-41d0-8f5e-8c99199e67a2@app.fastmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox