Re: can while loop in ClockSweepTick function be kind of infinite loop in some cases? - Mailing list pgsql-hackers

From Robert Haas
Subject Re: can while loop in ClockSweepTick function be kind of infinite loop in some cases?
Date
Msg-id CA+TgmoaXg=OUJTLYjuN-8J3iZe9xZUHKOeFO7EBAgugGy76Kqw@mail.gmail.com
Whole thread Raw
In response to Re: can while loop in ClockSweepTick function be kind of infinite loop in some cases?  (Andres Freund <andres@anarazel.de>)
Responses Re: can while loop in ClockSweepTick function be kind of infinite loop in some cases?
List pgsql-hackers
On Tue, Jan 10, 2023 at 12:40 PM Andres Freund <andres@anarazel.de> wrote:
> > I think. `expected = originalVictim + 1;` line should be in while loop
> > (before acquiring spin lock) so that, even in the case above, expected
> > variable is incremented for each loop and CAS operation will be successful
> > at some point.
> > Is my understanding correct? If so, I will send PR for fixing this issue.
>
> Yes, I think your understanding might be correct. Interesting that this
> apparently has never occurred.

Doesn't pg_atomic_compare_exchange_u32 set expected if it fails?

-- 
Robert Haas
EDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: Avoiding "wrong tuple length" errors at the end of VACUUM on pg_database update (Backpatch of 947789f to v12 and v13)
Next
From: Tomas Vondra
Date:
Subject: Re: logical decoding and replication of sequences, take 2