Re: Race conditions in logical decoding

From: Alvaro Herrera <alvherre(at)kurilemu(dot)de>
To: Rui Zhao <zhaorui126(at)gmail(dot)com>
Cc: Antonin Houska <ah(at)cybertec(dot)at>, 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-21 16:56:27
Message-ID: arFgusAC7MFhUaAh@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2026-Sep-21, Alvaro Herrera wrote:

> Yeah, maybe this approach isn't great after all. We could turn that
> around and search for each loop around the snap->xmin..snap->xmax loop
> that is found in snap->xip in the running->xids array. That reduces the
> number of times we go through XactLockTableWait() to only running
> transactions (same as in Rui's original patch [1]). However, the
> running->xids array is not sorted, so we would have to qsort() it, or do
> a plain array walk for each element.

BTW just to make it clear what I'm talking about, attached is the patch
for this approach, which I'm now thinking to throw away in favor of
Rui's earlier version. (The test contains the change Rui suggested
yesterday, and it's passing for me with this patch.) I didn't touch the
commit message.

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"Las cosas son buenas o malas segun las hace nuestra opinión" (Lisias)

Attachment Content-Type Size
v6-0001-Wait-for-the-transactions-of-an-initial-decoding-.patch text/x-diff 3.9 KB
v6-0002-Test-the-initial-decoding-snapshot-against-a-comm.patch text/x-diff 8.5 KB
v6-0003-Test-slot-creation-with-USE_SNAPSHOT-against-a-co.patch text/x-diff 6.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Alexandre Felipe 2026-09-21 16:42:08 Re: aio: worker: Free SMGR objects when idle