diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-06-14 22:15:33 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-06-14 22:15:33 +0000 |
commit | 8563ccae2caf0119355c5c80cfa59da19ce809d6 (patch) | |
tree | c53bd9d44280939a986d44e26d7ee1f29216cb3e /src/include/storage/lmgr.h | |
parent | f5835b4b8d569e4d7814886f9e7b90c36d8a4fb5 (diff) | |
download | postgresql-8563ccae2caf0119355c5c80cfa59da19ce809d6.tar.gz postgresql-8563ccae2caf0119355c5c80cfa59da19ce809d6.zip |
Simplify shared-memory lock data structures as per recent discussion:
it is sufficient to track whether a backend holds a lock or not, and
store information about transaction vs. session locks only in the
inside-the-backend LocalLockTable. Since there can now be but one
PROCLOCK per lock per backend, LockCountMyLocks() is no longer needed,
thus eliminating some O(N^2) behavior when a backend holds many locks.
Also simplify the LockAcquire/LockRelease API by passing just a
'sessionLock' boolean instead of a transaction ID. The previous API
was designed with the idea that per-transaction lock holding would be
important for subtransactions, but now that we have subtransactions we
know that this is unwanted. While at it, add an 'isTempObject' parameter
to LockAcquire to indicate whether the lock is being taken on a temp
table. This is not used just yet, but will be needed shortly for
two-phase commit.
Diffstat (limited to 'src/include/storage/lmgr.h')
-rw-r--r-- | src/include/storage/lmgr.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/include/storage/lmgr.h b/src/include/storage/lmgr.h index e9838807069..cdbf8ad406c 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.48 2005/04/30 19:03:33 tgl Exp $ + * $PostgreSQL: pgsql/src/include/storage/lmgr.h,v 1.49 2005/06/14 22:15:33 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -49,7 +49,8 @@ extern void LockRelation(Relation relation, LOCKMODE lockmode); extern bool ConditionalLockRelation(Relation relation, LOCKMODE lockmode); extern void UnlockRelation(Relation relation, LOCKMODE lockmode); -extern void LockRelationForSession(LockRelId *relid, LOCKMODE lockmode); +extern void LockRelationForSession(LockRelId *relid, bool istemprel, + LOCKMODE lockmode); extern void UnlockRelationForSession(LockRelId *relid, LOCKMODE lockmode); /* Lock a relation for extension */ |