diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-04-28 21:47:18 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-04-28 21:47:18 +0000 |
| commit | bedb78d386a47fd66b6cda2040e0a5fb545ee371 (patch) | |
| tree | 0db0af8556ff82d94423e8e21362900afb18b7b6 /src/include/storage | |
| parent | d902e7d63ba2dc9cf0a1b051b2911b96831ef227 (diff) | |
| download | postgresql-bedb78d386a47fd66b6cda2040e0a5fb545ee371.tar.gz | |
Implement sharable row-level locks, and use them for foreign key references
to eliminate unnecessary deadlocks. This commit adds SELECT ... FOR SHARE
paralleling SELECT ... FOR UPDATE. The implementation uses a new SLRU
data structure (managed much like pg_subtrans) to represent multiple-
transaction-ID sets. When more than one transaction is holding a shared
lock on a particular row, we create a MultiXactId representing that set
of transactions and store its ID in the row's XMAX. This scheme allows
an effectively unlimited number of row locks, just as we did before,
while not costing any extra overhead except when a shared lock actually
has to be shared. Still TODO: use the regular lock manager to control
the grant order when multiple backends are waiting for a row lock.
Alvaro Herrera and Tom Lane.
Diffstat (limited to 'src/include/storage')
| -rw-r--r-- | src/include/storage/bufpage.h | 5 | ||||
| -rw-r--r-- | src/include/storage/lmgr.h | 4 | ||||
| -rw-r--r-- | src/include/storage/lwlock.h | 5 |
3 files changed, 9 insertions, 5 deletions
diff --git a/src/include/storage/bufpage.h b/src/include/storage/bufpage.h index 8b195132cb..c02bb4dc87 100644 --- a/src/include/storage/bufpage.h +++ b/src/include/storage/bufpage.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/bufpage.h,v 1.64 2005/03/22 06:17:03 tgl Exp $ + * $PostgreSQL: pgsql/src/include/storage/bufpage.h,v 1.65 2005/04/28 21:47:18 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -135,8 +135,9 @@ typedef PageHeaderData *PageHeader; * Page layout version number 0 is for pre-7.3 Postgres releases. * Releases 7.3 and 7.4 use 1, denoting a new HeapTupleHeader layout. * Release 8.0 changed the HeapTupleHeader layout again. + * Release 8.1 redefined HeapTupleHeader infomask bits. */ -#define PG_PAGE_LAYOUT_VERSION 2 +#define PG_PAGE_LAYOUT_VERSION 3 /* ---------------------------------------------------------------- diff --git a/src/include/storage/lmgr.h b/src/include/storage/lmgr.h index 6aec7bf19c..8d63294f5c 100644 --- a/src/include/storage/lmgr.h +++ b/src/include/storage/lmgr.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/lmgr.h,v 1.45 2004/12/31 22:03:42 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/storage/lmgr.h,v 1.46 2005/04/28 21:47:18 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -23,7 +23,7 @@ #define NoLock 0 #define AccessShareLock 1 /* SELECT */ -#define RowShareLock 2 /* SELECT FOR UPDATE */ +#define RowShareLock 2 /* SELECT FOR UPDATE/FOR SHARE */ #define RowExclusiveLock 3 /* INSERT, UPDATE, DELETE */ #define ShareUpdateExclusiveLock 4 /* VACUUM (non-FULL) */ #define ShareLock 5 /* CREATE INDEX */ diff --git a/src/include/storage/lwlock.h b/src/include/storage/lwlock.h index 50c029cc8b..18215f4838 100644 --- a/src/include/storage/lwlock.h +++ b/src/include/storage/lwlock.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/lwlock.h,v 1.17 2005/03/04 20:21:07 tgl Exp $ + * $PostgreSQL: pgsql/src/include/storage/lwlock.h,v 1.18 2005/04/28 21:47:18 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -40,6 +40,9 @@ typedef enum LWLockId CheckpointStartLock, CLogControlLock, SubtransControlLock, + MultiXactGenLock, + MultiXactOffsetControlLock, + MultiXactMemberControlLock, RelCacheInitLock, BgWriterCommLock, |
