| From: | Álvaro Herrera <alvherre(at)kurilemu(dot)de> |
|---|---|
| To: | "Zhijie Hou" <houzhijie22(at)gmail(dot)com>, "Bingshuai Li" <lucian1412(at)outlook(dot)com> |
| Cc: | "kuroda(dot)hayato(at)fujitsu(dot)com" <kuroda(dot)hayato(at)fujitsu(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>, "L(dot) pgsql-hackers" <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-09 18:11:18 |
| Message-ID: | 57137b0d-dad2-41d0-8f5e-8c99199e67a2@app.fastmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Marcos Pegoraro | 2026-10-09 19:04:22 | Re: Proposal: SELECT * EXCLUDE (...) command |
| Previous Message | Manu | 2026-10-09 17:48:42 | Re: [PATCH] Extensible ReadyForQuery wire protocol message and C hook, for connection pools and WAIT FOR LSN |