Re: Bug in logical decoding with DDL and subtransactions - Mailing list pgsql-hackers

From alvherre@kurilemu.de
Subject Re: Bug in logical decoding with DDL and subtransactions
Date
Msg-id aqvJDO3fYcomY4Cr@alvherre.pgsql
Whole thread
In response to Re: Bug in logical decoding with DDL and subtransactions  (Bingshuai Li <lucian1412@outlook.com>)
Responses Re: Bug in logical decoding with DDL and subtransactions
List pgsql-hackers
On 2026-Sep-17, Bingshuai Li wrote:

> With the buildfarm now red on HEAD and PostgreSQL 19 GA
> approaching, could a committer please take a look at v4?  The two
> points where I would most appreciate judgement are unchanged from
> my August 27 mail: the restart_lsn invariant (section 2 of the v4
> mail), and whether the O(N) abort-time cleanup is acceptable to
> backpatch.  I also believe this strengthens the case for tracking
> BUG #19555 as a PostgreSQL 19 open item.

What's the reason to consider this as a worse problem in 19 than in
previous releases?  In my mind it's pretty clear that this bug needs to
be fixed in all stable branches.  Moreover, I think the real deadline
here is the next set of minors to be released in November, rather than
the 19.0 release.  The November minors would also include 19.1.

> I'm happy to prepare a REL_19_STABLE version of the patch if that
> would help.

If the proposed patch has any conflicts when applied on any previous
branches, then by all means please do provide backpatches as
appropriate.  However, if the same patch applies cleanly or only has
trivial conflicts, then there's no need.  (I see there's a trivial
conflict in 18's test schedule files for instance, for which IMO you
don't need to provide a patch.  Didn't try further back.)

The patch does change the layout of ReorderBufferChange, which is
apparently an exported struct, so some analysis on whether that can
break anything would also be useful.  It might be innocuous, if there
are no external users, but better make sure ...

--- /tmp/ReorderBufferChange.unpatched  2026-09-17 13:09:09.517276936 +0200
+++ /tmp/ReorderBufferChange.patched    2026-09-17 13:09:35.505580268 +0200
@@ -37,27 +37,29 @@
        CommandId          command_id;           /*    32     4 */
        struct {
            RelFileLocator locator;          /*    32    12 */
            ItemPointerData tid __attribute__((__aligned__(2))); /*    44     6 */
 
            /* XXX 2 bytes hole, try to pack */
 
            CommandId  cmin;                 /*    52     4 */
            CommandId  cmax;                 /*    56     4 */
            CommandId  combocid;             /*    60     4 */
-       } __attribute__((__aligned__(4))) tuplecid __attribute__((__aligned__(4)));  /*    32    32 */
+           /* --- cacheline 1 boundary (64 bytes) --- */
+           TransactionId subxid;            /*    64     4 */
+       } __attribute__((__aligned__(4))) tuplecid __attribute__((__aligned__(4)));  /*    32    36 */
        struct {
            uint32     ninvalidations;       /*    32     4 */
 
            /* XXX 4 bytes hole, try to pack */
 
            SharedInvalidationMessage * invalidations; /*    40     8 */
        } inval;                                 /*    32    16 */
-   } data __attribute__((__aligned__(8)));          /*    32    32 */
-   /* --- cacheline 1 boundary (64 bytes) --- */
-   dlist_node                 node;                 /*    64    16 */
+   } data __attribute__((__aligned__(8)));          /*    32    40 */
+   /* --- cacheline 1 boundary (64 bytes) was 8 bytes ago --- */
+   dlist_node                 node;                 /*    72    16 */
 
-   /* size: 80, cachelines: 2, members: 6 */
-   /* sum members: 70, holes: 2, sum holes: 10 */
+   /* size: 88, cachelines: 2, members: 6 */
+   /* sum members: 78, holes: 2, sum holes: 10 */
    /* forced alignments: 1, forced holes: 1, sum forced holes: 6 */
-   /* last cacheline: 16 bytes */
+   /* last cacheline: 24 bytes */
 } __attribute__((__aligned__(8)));

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"Debido a que la velocidad de la luz es mucho mayor que la del sonido,
 algunas personas nos parecen brillantes un minuto antes
 de escuchar las pelotudeces que dicen." (Roberto Fontanarrosa)



pgsql-hackers by date:

Previous
From: Etsuro Fujita
Date:
Subject: Re: [PG19][PATCH] Make postgres_fdw statistics import atomic
Next
From: Henson Choi
Date:
Subject: Re: [SQL/PGQ] Native executor for Graph query