mirror of
https://github.com/postgres/postgres.git
synced 2025-04-20 00:42:27 +03:00
Use standard compare_exchange loop style in ProcArrayGroupClearXid().
Besides style, this might improve performance in the contended case. Reviewed by Amit Kapila. Discussion: https://postgr.es/m/20191015035348.GA4166224@rfd.leadboat.com
This commit is contained in:
parent
30ee5d17c2
commit
48cc59ed24
@ -493,9 +493,9 @@ ProcArrayGroupClearXid(PGPROC *proc, TransactionId latestXid)
|
|||||||
/* Add ourselves to the list of processes needing a group XID clear. */
|
/* Add ourselves to the list of processes needing a group XID clear. */
|
||||||
proc->procArrayGroupMember = true;
|
proc->procArrayGroupMember = true;
|
||||||
proc->procArrayGroupMemberXid = latestXid;
|
proc->procArrayGroupMemberXid = latestXid;
|
||||||
|
nextidx = pg_atomic_read_u32(&procglobal->procArrayGroupFirst);
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
nextidx = pg_atomic_read_u32(&procglobal->procArrayGroupFirst);
|
|
||||||
pg_atomic_write_u32(&proc->procArrayGroupNext, nextidx);
|
pg_atomic_write_u32(&proc->procArrayGroupNext, nextidx);
|
||||||
|
|
||||||
if (pg_atomic_compare_exchange_u32(&procglobal->procArrayGroupFirst,
|
if (pg_atomic_compare_exchange_u32(&procglobal->procArrayGroupFirst,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user