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

Commit8767a86

Browse files
committed
Fix variable shadowing in procarray.c.
ProcArrayGroupClearXid function has a parameter named "proc",but the same name was used for its local variables. This commit fixesthis variable shadowing, to improve code readability.Back-patch to all supported versions, to make future back-patchingeasy though this patch is classified as refactoring only.Reported-by: Ranier VilelaAuthor: Ranier Vilela, Aleksander Alekseevhttps://postgr.es/m/CAEudQAqyoTZC670xWi6w-Oe2_Bk1bfu2JzXz6xRfiOUzm7xbyQ@mail.gmail.com
1 parente06cc02 commit8767a86

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -552,13 +552,13 @@ ProcArrayGroupClearXid(PGPROC *proc, TransactionId latestXid)
552552
/* Walk the list and clear all XIDs. */
553553
while (nextidx!=INVALID_PGPROCNO)
554554
{
555-
PGPROC*proc=&allProcs[nextidx];
555+
PGPROC*nextproc=&allProcs[nextidx];
556556
PGXACT*pgxact=&allPgXact[nextidx];
557557

558-
ProcArrayEndTransactionInternal(proc,pgxact,proc->procArrayGroupMemberXid);
558+
ProcArrayEndTransactionInternal(nextproc,pgxact,nextproc->procArrayGroupMemberXid);
559559

560560
/* Move to next proc in list. */
561-
nextidx=pg_atomic_read_u32(&proc->procArrayGroupNext);
561+
nextidx=pg_atomic_read_u32(&nextproc->procArrayGroupNext);
562562
}
563563

564564
/* We're done with the lock now. */
@@ -573,18 +573,18 @@ ProcArrayGroupClearXid(PGPROC *proc, TransactionId latestXid)
573573
*/
574574
while (wakeidx!=INVALID_PGPROCNO)
575575
{
576-
PGPROC*proc=&allProcs[wakeidx];
576+
PGPROC*nextproc=&allProcs[wakeidx];
577577

578-
wakeidx=pg_atomic_read_u32(&proc->procArrayGroupNext);
579-
pg_atomic_write_u32(&proc->procArrayGroupNext,INVALID_PGPROCNO);
578+
wakeidx=pg_atomic_read_u32(&nextproc->procArrayGroupNext);
579+
pg_atomic_write_u32(&nextproc->procArrayGroupNext,INVALID_PGPROCNO);
580580

581581
/* ensure all previous writes are visible before follower continues. */
582582
pg_write_barrier();
583583

584-
proc->procArrayGroupMember= false;
584+
nextproc->procArrayGroupMember= false;
585585

586-
if (proc!=MyProc)
587-
PGSemaphoreUnlock(proc->sem);
586+
if (nextproc!=MyProc)
587+
PGSemaphoreUnlock(nextproc->sem);
588588
}
589589
}
590590

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp