mirror of
https://github.com/postgres/postgres.git
synced 2025-11-19 13:42:17 +03:00
Migrate PGPROC's backendLock into PGPROC itself, using a new tranche.
Previously, each PGPROC's backendLock was part of the main tranche, and the PGPROC just contained a pointer. Now, the actual LWLock is part of the PGPROC. As with previous, similar patches, this makes it significantly easier to identify these lwlocks in LWLOCK_STATS or Trace_lwlocks output and improves modularity. Author: Ildus Kurbangaliev Reviewed-by: Amit Kapila, Robert Haas
This commit is contained in:
@@ -106,6 +106,9 @@ static TransactionId *KnownAssignedXids;
|
||||
static bool *KnownAssignedXidsValid;
|
||||
static TransactionId latestObservedXid = InvalidTransactionId;
|
||||
|
||||
/* LWLock tranche for backend locks */
|
||||
static LWLockTranche ProcLWLockTranche;
|
||||
|
||||
/*
|
||||
* If we're in STANDBY_SNAPSHOT_PENDING state, standbySnapshotPendingXmin is
|
||||
* the highest xid that might still be running that we don't have in
|
||||
@@ -261,6 +264,13 @@ CreateSharedProcArray(void)
|
||||
mul_size(sizeof(bool), TOTAL_MAX_CACHED_SUBXIDS),
|
||||
&found);
|
||||
}
|
||||
|
||||
/* Register and initialize fields of ProcLWLockTranche */
|
||||
ProcLWLockTranche.name = "proc";
|
||||
ProcLWLockTranche.array_base = (char *) (ProcGlobal->allProcs) +
|
||||
offsetof(PGPROC, backendLock);
|
||||
ProcLWLockTranche.array_stride = sizeof(PGPROC);
|
||||
LWLockRegisterTranche(LWTRANCHE_PROC, &ProcLWLockTranche);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user