Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2f39106

Browse files
committed
Replace CAS loop with single TAS in ProcArrayGroupClearXid()
Single pg_atomic_exchange_u32() is expected to be faster than loop ofpg_atomic_compare_exchange_u32(). Also, it would be consistent withclog group update code.Discussion:https://postgr.es/m/CAPpHfdtxLsC-bqfxFcHswZ91OxXcZVNDBBVfg9tAWU0jvn1tQA%40mail.gmail.comReviewed-by: Amit Kapila
1 parentdb361db commit2f39106

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

‎src/backend/storage/ipc/procarray.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -542,14 +542,8 @@ ProcArrayGroupClearXid(PGPROC *proc, TransactionId latestXid)
542542
* group XID clearing, saving a pointer to the head of the list. Trying
543543
* to pop elements one at a time could lead to an ABA problem.
544544
*/
545-
while (true)
546-
{
547-
nextidx=pg_atomic_read_u32(&procglobal->procArrayGroupFirst);
548-
if (pg_atomic_compare_exchange_u32(&procglobal->procArrayGroupFirst,
549-
&nextidx,
550-
INVALID_PGPROCNO))
551-
break;
552-
}
545+
nextidx=pg_atomic_exchange_u32(&procglobal->procArrayGroupFirst,
546+
INVALID_PGPROCNO);
553547

554548
/* Remember head of list so we can perform wakeups after dropping lock. */
555549
wakeidx=nextidx;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp