diff options
Diffstat (limited to 'src/include/storage/proc.h')
-rw-r--r-- | src/include/storage/proc.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index 4819cb81108..09ac3cf967b 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -51,6 +51,14 @@ struct XidCache #define PROC_VACUUM_STATE_MASK (0x0E) /* + * We allow a small number of "weak" relation locks (AccesShareLock, + * RowShareLock, RowExclusiveLock) to be recorded in the PGPROC structure + * rather than the main lock table. This eases contention on the lock + * manager LWLocks. See storage/lmgr/README for additional details. + */ +#define FP_LOCK_SLOTS_PER_BACKEND 16 + +/* * Each backend has a PGPROC struct in shared memory. There is also a list of * currently-unused PGPROC structs that will be reallocated to new backends. * @@ -137,6 +145,13 @@ struct PGPROC SHM_QUEUE myProcLocks[NUM_LOCK_PARTITIONS]; struct XidCache subxids; /* cache for subtransaction XIDs */ + + /* Per-backend LWLock. Protects fields below. */ + LWLockId backendLock; /* protects the fields below */ + + /* Lock manager data, recording fast-path locks taken by this backend. */ + uint64 fpLockBits; /* lock modes held for each fast-path slot */ + Oid fpRelId[FP_LOCK_SLOTS_PER_BACKEND]; /* slots for rel oids */ }; /* NOTE: "typedef struct PGPROC PGPROC" appears in storage/lock.h. */ @@ -150,6 +165,10 @@ extern PGDLLIMPORT PGPROC *MyProc; */ typedef struct PROC_HDR { + /* Array of PGPROC structures (not including dummies for prepared txns) */ + PGPROC *allProcs; + /* Length of allProcs array */ + uint32 allProcCount; /* Head of list of free PGPROC structures */ PGPROC *freeProcs; /* Head of list of autovacuum's free PGPROC structures */ @@ -163,6 +182,8 @@ typedef struct PROC_HDR int startupBufferPinWaitBufId; } PROC_HDR; +extern PROC_HDR *ProcGlobal; + /* * We set aside some extra PGPROC structures for auxiliary processes, * ie things that aren't full-fledged backends but need shmem access. |