On Tue, Jan 10, 2023 at 12:40 PM Andres Freund <and...@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