Re: Race conditions in logical decoding - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Race conditions in logical decoding
Date
Msg-id aq1Jy9aVF-lIhKwe@alvherre.pgsql
Whole thread
In response to Re: Race conditions in logical decoding  (Antonin Houska <ah@cybertec.at>)
Responses Re: Race conditions in logical decoding
List pgsql-hackers
On 2026-Sep-18, Antonin Houska wrote:

> Maybe I miss the point, but what's wrong about modifying the existing loop
> that inverts the meaning of the ->xip array
> 
>     /*
>      * snapbuild.c builds transactions in an "inverted" manner, which means it
>      * stores committed transactions in ->xip, not ones in progress. Build a
>      * classical snapshot by marking all non-committed transactions as
>      * in-progress. This can be expensive.
>      */
>     for (xid = snap->xmin; NormalTransactionIdPrecedes(xid, snap->xmax);)
>     {
>         ...
>     }
> 
> by calling XactLockTableWait() for each XID we find in the array (i.e. each
> committed transaction)?

Ah, you mean something like the attached quick POC?  This does pass the
two tests that Rui wrote, also attached.  (I didn't test Zhijie's, which
AFAICT is written to pass with the bug and fail without it.)

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"They proved that being American is not just for some people"
                                               (George Takei)

Attachment

pgsql-hackers by date:

Previous
From: Dmitry Dolgov
Date:
Subject: Re: Routed ON CONFLICT inserts broken by partition-local deferrable unique constraints in 19 and master
Next
From: Atsushi Ogawa
Date:
Subject: Re: [PATCH] Use Boyer-Moore-Horspool for simple LIKE contains patterns