Hi! While investigating ProcArrayGroupClearXid() code I wonder why do we have this loop instead of plain pg_atomic_exchange_u32() call? Is it intentional?
/* * Now that we've got the lock, clear the list of processes waiting for * group XID clearing, saving a pointer to the head of the list. Trying * to pop elements one at a time could lead to an ABA problem. */ while (true) { nextidx = pg_atomic_read_u32(&procglobal->procArrayGroupFirst); if (pg_atomic_compare_exchange_u32(&procglobal->procArrayGroupFirst, &nextidx, INVALID_PGPROCNO)) break; } ------ Alexander Korotkov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company