From 51619642f910f19788c55b06778629fffa3aa382 Mon Sep 17 00:00:00 2001 From: Matthias van de Meent Date: Wed, 12 Aug 2026 22:13:38 +0200 Subject: [PATCH v4] Minor copy-edits - Adjusted wording in various comments - Adjust ProcGetMyXactOff to use MyProcNumber, not GetNumberFromPGProc(MyProc) --- src/backend/storage/ipc/procarray.c | 5 +++-- src/include/storage/proc.h | 19 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c index 3dd46d91811..e00a255fa6d 100644 --- a/src/backend/storage/ipc/procarray.c +++ b/src/backend/storage/ipc/procarray.c @@ -285,8 +285,9 @@ typedef enum KAXCompressReason static PGPROC *allProcs; /* - * offsets into various ProcGlobal->arrays with data mirrored from appropriate PGPROCs, - * procno define offset index in pgxactoffs array(See PROC_HDR for details). + * offsets into various ProcGlobal->arrays with data mirrored from + * appropriate PGPROCs, procno define offset index in pgxactoffs array(See + * PROC_HDR for details). */ static int *pgxactoffs; diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index e08d8dd8a4a..8cbc8928dd5 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -174,7 +174,7 @@ typedef enum * * Some fields in PGPROC (see "mirrored in ..." comment) are mirrored into an * element of more densely packed ProcGlobal arrays. These arrays are indexed - * by PROC_HDR->pgxactoffs array elements. Both copies need to be maintained + * by a PGPROC's pgxactoffs entry. Both copies need to be maintained * coherently. * * NB: The pgxactoff indexed value can *never* be accessed without holding @@ -400,11 +400,11 @@ extern PGDLLIMPORT PGPROC *MyProc; * for PGPROCs that have been added to the shared array with ProcArrayAdd() * (in contrast to PGPROC array which has unused PGPROCs interspersed). * - * The dense arrays are indexed by PROC_HDR->pgxactoffs array elements, procno - * define position of appropriate offset in pgxactoffs array. Any concurrent - * ProcArrayAdd() / ProcArrayRemove() can lead to pgxactoff of a procarray - * member to change. Therefore it is only safe to use appropriate proc's pgxactoff - * to access the dense array while holding either ProcArrayLock or XidGenLock. + * The dense arrays are indexed by the PGPROC's corresponding offset in + * pgxactoff. Any concurrent ProcArrayAdd() / ProcArrayRemove() can cause + * the pgxactoff of a procarray member to change. Therefore it is only safe + * to use a proc's pgxactoff to access the dense array while holding either + * ProcArrayLock or XidGenLock. * * As long as a PGPROC is in the procarray, the mirrored values need to be * maintained in both places in a coherent manner. @@ -446,9 +446,8 @@ typedef struct PROC_HDR PGPROC *allProcs; /* - * offsets into various ProcGlobal->arrays with data mirrored from - * appropriate PGPROCs. The PGPROC's appropriate pgxactoff element index - * is the same as PGPROC index in allProcs(check ProcGetMyXactOff). + * Dense offsets into various ProcGlobal->arrays with data mirrored from + * appropriate PGPROCs. Like allProcs, values are indexed by ProcNumber. */ int *pgxactoffs; @@ -518,7 +517,7 @@ extern PGDLLIMPORT PGPROC *PreparedXactProcs; #define GetPGProcByNumber(n) (&ProcGlobal->allProcs[(n)]) #define GetNumberFromPGProc(proc) ((proc) - &ProcGlobal->allProcs[0]) #define ProcGetXactOff(procno) (ProcGlobal->pgxactoffs[(procno)]) -#define ProcGetMyXactOff() (ProcGetXactOff(GetNumberFromPGProc(MyProc))) +#define ProcGetMyXactOff() (ProcGetXactOff(MyProcNumber)) /* * We set aside some extra PGPROC structures for "special worker" processes, -- 2.50.1 (Apple Git-155)