RE: Bug in logical decoding with DDL and subtransactions

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: "'alvherre(at)kurilemu(dot)de'" <alvherre(at)kurilemu(dot)de>, Zhijie Hou <houzhijie22(at)gmail(dot)com>
Cc: Bingshuai Li <lucian1412(at)outlook(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alexander Lakhin <exclusion(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "mark(dot)dilger(at)enterprisedb(dot)com" <mark(dot)dilger(at)enterprisedb(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com>, "a(dot)kozhemyakin(at)postgrespro(dot)ru" <a(dot)kozhemyakin(at)postgrespro(dot)ru>
Subject: RE: Bug in logical decoding with DDL and subtransactions
Date: 2026-10-13 09:17:10
Message-ID: OS7PR01MB1831754313E2D2084901C21DBF59E2@OS7PR01MB18317.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Álvaro,

> Okay, I spent some more time trying to rewrite these comments in the new
> function so that they explain what we're doing in terms we use elsewhere
> in the code, and according to my understanding of how this works. The
> phrasing proposed by Bingshuai contains some terms that we don't use
> anywhere else, such as "a decoding pass" and other variations thereof,
> referring to the logical decoding "session". I would appreciate a
> review for correctness; if it's wrong, please propose fixes as minimal
> as possible (that is, not a complete rewrite).

I checked your proposal, LGTM.

> By the way, the assurance that with this coding we will never call
> bsearch() with a NULL subxact array seems a bit too trusting ... I think
> we should just add the "return false" if nsubxacts == 0 in
> TransactionIdInSubxactArray() just to be on the safe side. It costs
> nothing.

The cfbot detected the issue, so +1 to add in TransactionIdInSubxactArray().

[1]: https://github.com/postgres/postgres-cfbot/actions/runs/38178880728/job/114587272272

Best regards,
Hayato Kuroda
FUJITSU LIMITED

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Paul Kim 2026-10-13 09:26:40 Re: Be strict when request to flush past end of WAL in WaitXLogInsertionsToFinish
Previous Message Jakub Wartak 2026-10-13 09:08:58 Re: [PATCH] Reduce LWLockWaitListLock() cache-line contention with adaptive spin reads