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

Commitd1a2fa3

Browse files
author
Amit Kapila
committed
Fix the initialization of atomic variable introduced by the
group clearing mechanism.Commit0e141c0 introduced initialization of atomic variable inInitProcess which means that it's not safe to look at it for backends thataren't currently in use. Fix that by initializing the same during postmasterstartup.Reported-by: Andres FreundAuthor: Amit KapilaBackpatch-through: 9.6Discussion:https://postgr.es/m/20181027104138.qmbbelopvy7cw2qv@alap3.anarazel.de
1 parent5574a01 commitd1a2fa3

File tree

1 file changed

+7
-1
lines changed
  • src/backend/storage/lmgr

1 file changed

+7
-1
lines changed

‎src/backend/storage/lmgr/proc.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,12 @@ InitProcGlobal(void)
266266

267267
/* Initialize lockGroupMembers list. */
268268
dlist_init(&procs[i].lockGroupMembers);
269+
270+
/*
271+
* Initialize the atomic variable, otherwise, it won't be safe to
272+
* access it for backends that aren't currently in use.
273+
*/
274+
pg_atomic_init_u32(&(procs[i].procArrayGroupNext),INVALID_PGPROCNO);
269275
}
270276

271277
/*
@@ -399,7 +405,7 @@ InitProcess(void)
399405
/* Initialize fields for group XID clearing. */
400406
MyProc->procArrayGroupMember= false;
401407
MyProc->procArrayGroupMemberXid=InvalidTransactionId;
402-
pg_atomic_init_u32(&MyProc->procArrayGroupNext,INVALID_PGPROCNO);
408+
Assert(pg_atomic_read_u32(&MyProc->procArrayGroupNext)==INVALID_PGPROCNO);
403409

404410
/* Check that group locking fields are in a proper initial state. */
405411
Assert(MyProc->lockGroupLeader==NULL);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp