diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-08-18 16:09:13 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-08-18 16:09:13 +0000 |
commit | 7aa772f03e03c361683cf05c8cd66a9bfc8956c7 (patch) | |
tree | 4fb82294b3cdbdb9ddb9b8bd3c81407d6189bb57 /src/backend/storage/lmgr/lmgr.c | |
parent | e91600d1c2e79914e6c8ac445c340e704c710b66 (diff) | |
download | postgresql-7aa772f03e03c361683cf05c8cd66a9bfc8956c7.tar.gz postgresql-7aa772f03e03c361683cf05c8cd66a9bfc8956c7.zip |
Now that we've rearranged relation open to get a lock before touching
the rel, it's easy to get rid of the narrow race-condition window that
used to exist in VACUUM and CLUSTER. Did some minor code-beautification
work in the same area, too.
Diffstat (limited to 'src/backend/storage/lmgr/lmgr.c')
-rw-r--r-- | src/backend/storage/lmgr/lmgr.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/backend/storage/lmgr/lmgr.c b/src/backend/storage/lmgr/lmgr.c index ad7ee3e6013..4442d3909f0 100644 --- a/src/backend/storage/lmgr/lmgr.c +++ b/src/backend/storage/lmgr/lmgr.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/lmgr/lmgr.c,v 1.86 2006/07/31 20:09:05 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/storage/lmgr/lmgr.c,v 1.87 2006/08/18 16:09:09 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -128,8 +128,8 @@ ConditionalLockRelationOid(Oid relid, LOCKMODE lockmode) /* * UnlockRelationId * - * Note: we don't supply UnlockRelationOid since it's normally easy for - * callers to provide the LockRelId info from a relcache entry. + * Unlock, given a LockRelId. This is preferred over UnlockRelationOid + * for speed reasons. */ void UnlockRelationId(LockRelId *relid, LOCKMODE lockmode) @@ -142,6 +142,21 @@ UnlockRelationId(LockRelId *relid, LOCKMODE lockmode) } /* + * UnlockRelationOid + * + * Unlock, given only a relation Oid. Use UnlockRelationId if you can. + */ +void +UnlockRelationOid(Oid relid, LOCKMODE lockmode) +{ + LOCKTAG tag; + + SetLocktagRelationOid(&tag, relid); + + LockRelease(&tag, lockmode, false); +} + +/* * LockRelation * * This is a convenience routine for acquiring an additional lock on an |