mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +03:00
Move "hot" members of PGPROC into a separate PGXACT array.
This speeds up snapshot-taking and reduces ProcArrayLock contention. Also, the PGPROC (and PGXACT) structures used by two-phase commit are now allocated as part of the main array, rather than in a separate array, and we keep ProcArray sorted in pointer order. These changes are intended to minimize the number of cache lines that must be pulled in to take a snapshot, and testing shows a substantial increase in performance on both read and write workloads at high concurrencies. Pavan Deolasee, Heikki Linnakangas, Robert Haas
This commit is contained in:
@@ -450,6 +450,7 @@ FindLockCycleRecurse(PGPROC *checkProc,
|
||||
int *nSoftEdges) /* output argument */
|
||||
{
|
||||
PGPROC *proc;
|
||||
PGXACT *pgxact;
|
||||
LOCK *lock;
|
||||
PROCLOCK *proclock;
|
||||
SHM_QUEUE *procLocks;
|
||||
@@ -516,6 +517,7 @@ FindLockCycleRecurse(PGPROC *checkProc,
|
||||
while (proclock)
|
||||
{
|
||||
proc = proclock->tag.myProc;
|
||||
pgxact = &ProcGlobal->allPgXact[proc->pgprocno];
|
||||
|
||||
/* A proc never blocks itself */
|
||||
if (proc != checkProc)
|
||||
@@ -541,7 +543,7 @@ FindLockCycleRecurse(PGPROC *checkProc,
|
||||
* vacuumFlag bit), but we don't do that here to avoid
|
||||
* grabbing ProcArrayLock.
|
||||
*/
|
||||
if (proc->vacuumFlags & PROC_IS_AUTOVACUUM)
|
||||
if (pgxact->vacuumFlags & PROC_IS_AUTOVACUUM)
|
||||
blocking_autovacuum_proc = proc;
|
||||
|
||||
/* This proc hard-blocks checkProc */
|
||||
|
||||
Reference in New Issue
Block a user