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

2023-01-10 Thread
This question is about ClockSweepTick function and the code is below. https://github.com/postgres/postgres/blob/24d2b2680a8d0e01b30ce8a41c4eb3b47aca5031/src/backend/storage/buffer/freelist.c#L146-L165 The value of expected, NBuffers, wrapped variable is fixed in the while loop, so that when the v

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

2023-01-11 Thread
Hi, Thank you for your quick reply I misunderstood the logic of pg_atomic_compare_exchange_u32, so the loop cannot be infinite. > I wonder if we should make ->nextVictimBuffer a 64bit atomic. At the time the changes went in we didn't (or rather, couldn't) rely on it, but these days we could. I t