diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-12-11 21:02:18 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-12-11 21:02:18 +0000 |
| commit | ec0baf949ecdee0bf8d8e60cc8dba0137aac8d19 (patch) | |
| tree | b435a97a4e87c31a6b644ac2d9d1f433de487588 /src/include/storage/proc.h | |
| parent | be8100d64ec93ccd8160b37379ba189aab4d0ef1 (diff) | |
| download | postgresql-ec0baf949ecdee0bf8d8e60cc8dba0137aac8d19.tar.gz | |
Divide the lock manager's shared state into 'partitions', so as to
reduce contention for the former single LockMgrLock. Per my recent
proposal. I set it up for 16 partitions, but on a pgbench test this
gives only a marginal further improvement over 4 partitions --- we need
to test more scenarios to choose the number of partitions.
Diffstat (limited to 'src/include/storage/proc.h')
| -rw-r--r-- | src/include/storage/proc.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index 4cba391048..2cfee41eff 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/storage/proc.h,v 1.84 2005/10/15 02:49:46 momjian Exp $ + * $PostgreSQL: pgsql/src/include/storage/proc.h,v 1.85 2005/12/11 21:02:18 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -52,7 +52,8 @@ struct XidCache * so that the prepared transactions appear to be still running and are * correctly shown as holding locks. A prepared transaction PGPROC can be * distinguished from a real one at need by the fact that it has pid == 0. - * The semaphore and lock-related fields in a prepared-xact PGPROC are unused. + * The semaphore and lock-activity fields in a prepared-xact PGPROC are unused, + * but its myProcLocks[] lists are valid. */ struct PGPROC { @@ -86,8 +87,12 @@ struct PGPROC LOCKMASK heldLocks; /* bitmask for lock types already held on this * lock object by this backend */ - SHM_QUEUE procLocks; /* list of PROCLOCK objects for locks held or - * awaited by this backend */ + /* + * All PROCLOCK objects for locks held or awaited by this backend are + * linked into one of these lists, according to the partition number of + * their lock. + */ + SHM_QUEUE myProcLocks[NUM_LOCK_PARTITIONS]; struct XidCache subxids; /* cache for subtransaction XIDs */ }; @@ -99,7 +104,7 @@ extern DLLIMPORT PGPROC *MyProc; /* - * There is one ProcGlobal struct for the whole installation. + * There is one ProcGlobal struct for the whole database cluster. */ typedef struct PROC_HDR { @@ -134,8 +139,7 @@ extern bool HaveNFreeProcs(int n); extern void ProcReleaseLocks(bool isCommit); extern void ProcQueueInit(PROC_QUEUE *queue); -extern int ProcSleep(LockMethod lockMethodTable, LOCKMODE lockmode, - LOCK *lock, PROCLOCK *proclock); +extern int ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable); extern PGPROC *ProcWakeup(PGPROC *proc, int waitStatus); extern void ProcLockWakeup(LockMethod lockMethodTable, LOCK *lock); extern bool LockWaitCancel(void); |
