Re: Race conditions in logical decoding

From: Antonin Houska <ah(at)cybertec(dot)at>
To: alvherre(at)kurilemu(dot)de
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Race conditions in logical decoding
Date: 2026-01-29 19:52:47
Message-ID: 44674.1769716367@localhost
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Álvaro Herrera <alvherre(at)kurilemu(dot)de> wrote:

> On 2026-Jan-23, Antonin Houska wrote:
>
> > > This way you wait repeatedly for one transaction until it is marked
> > > committed; and once it does, you don't test it again.
> >
> > Sure, that's much beter. Thanks.
>
> Actually, I wonder if it would make sense to sleep just once after
> testing all the transactions for whether they are marked committed (not
> once per transaction); and after sleeping, we only test again those that
> were not marked committed in the previous iteration. I think you would
> end up doing less tests overall. Something like this

I suppose that TransactionIdDidCommit() returns false pretty rarely, so one
iteration is sufficient in almost all cases. Besides that, I preferred simpler
code because it's easier to test (It's not trivial to have debugger reach the
conditions.) However it's just my preference - no real objections to your
approach.

--
Antonin Houska
Web: https://www.cybertec-postgresql.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Marcos Pegoraro 2026-01-29 20:20:31 Re: Document NULL
Previous Message Marcos Pegoraro 2026-01-29 19:29:32 Re: Document NULL