Re: can while loop in ClockSweepTick function be kind of infinite loop in some cases?

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: 斯波隼斗 <shibahayaton(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: can while loop in ClockSweepTick function be kind of infinite loop in some cases?
Date: 2023-01-10 18:11:35
Message-ID: CA+TgmoaXg=OUJTLYjuN-8J3iZe9xZUHKOeFO7EBAgugGy76Kqw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 10, 2023 at 12:40 PM Andres Freund <andres(at)anarazel(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2023-01-10 18:32:12 Re: logical decoding and replication of sequences, take 2
Previous Message Nathan Bossart 2023-01-10 17:54:31 Re: Avoiding "wrong tuple length" errors at the end of VACUUM on pg_database update (Backpatch of 947789f to v12 and v13)