diff options
Diffstat (limited to 'src/backend/storage/ipc/procarray.c')
-rw-r--r-- | src/backend/storage/ipc/procarray.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c index ee2d7f8585a..dd329a86ef4 100644 --- a/src/backend/storage/ipc/procarray.c +++ b/src/backend/storage/ipc/procarray.c @@ -468,6 +468,7 @@ CreateSharedProcArray(void) void ProcArrayAdd(PGPROC *proc) { + int pgprocno = GetNumberFromPGProc(proc); ProcArrayStruct *arrayP = procArray; int index; int movecount; @@ -499,13 +500,13 @@ ProcArrayAdd(PGPROC *proc) */ for (index = 0; index < arrayP->numProcs; index++) { - int procno PG_USED_FOR_ASSERTS_ONLY = arrayP->pgprocnos[index]; + int this_procno = arrayP->pgprocnos[index]; - Assert(procno >= 0 && procno < (arrayP->maxProcs + NUM_AUXILIARY_PROCS)); - Assert(allProcs[procno].pgxactoff == index); + Assert(this_procno >= 0 && this_procno < (arrayP->maxProcs + NUM_AUXILIARY_PROCS)); + Assert(allProcs[this_procno].pgxactoff == index); /* If we have found our right position in the array, break */ - if (arrayP->pgprocnos[index] > proc->pgprocno) + if (this_procno > pgprocno) break; } @@ -523,7 +524,7 @@ ProcArrayAdd(PGPROC *proc) &ProcGlobal->statusFlags[index], movecount * sizeof(*ProcGlobal->statusFlags)); - arrayP->pgprocnos[index] = proc->pgprocno; + arrayP->pgprocnos[index] = GetNumberFromPGProc(proc); proc->pgxactoff = index; ProcGlobal->xids[index] = proc->xid; ProcGlobal->subxidStates[index] = proc->subxidStatus; @@ -791,6 +792,7 @@ ProcArrayEndTransactionInternal(PGPROC *proc, TransactionId latestXid) static void ProcArrayGroupClearXid(PGPROC *proc, TransactionId latestXid) { + int pgprocno = GetNumberFromPGProc(proc); PROC_HDR *procglobal = ProcGlobal; uint32 nextidx; uint32 wakeidx; @@ -808,7 +810,7 @@ ProcArrayGroupClearXid(PGPROC *proc, TransactionId latestXid) if (pg_atomic_compare_exchange_u32(&procglobal->procArrayGroupFirst, &nextidx, - (uint32) proc->pgprocno)) + (uint32) pgprocno)) break; } |