| From: | Alvaro Herrera <alvherre(at)kurilemu(dot)de> |
|---|---|
| To: | Antonin Houska <ah(at)cybertec(dot)at> |
| Cc: | Rui Zhao <zhaorui126(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Mihail Nikalayeu <mihailnikalayeu(at)gmail(dot)com> |
| Subject: | Re: Race conditions in logical decoding |
| Date: | 2026-09-18 14:29:20 |
| Message-ID: | aq1Jy9aVF-lIhKwe@alvherre.pgsql |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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 | Content-Type | Size |
|---|---|---|
| v5-0001-Wait-for-the-transactions-of-an-initial-decoding-.patch | text/x-diff | 2.3 KB |
| v5-0002-Test-the-initial-decoding-snapshot-against-a-comm.patch | text/x-diff | 8.5 KB |
| v5-0003-Test-slot-creation-with-USE_SNAPSHOT-against-a-co.patch | text/x-diff | 6.6 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Atsushi Ogawa | 2026-09-18 14:40:27 | Re: [PATCH] Use Boyer-Moore-Horspool for simple LIKE contains patterns |
| Previous Message | Dmitry Dolgov | 2026-09-18 14:28:27 | Re: Routed ON CONFLICT inserts broken by partition-local deferrable unique constraints in 19 and master |