1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-11 10:01:57 +03:00

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.
This commit is contained in:
Tom Lane
2006-08-18 16:09:13 +00:00
parent e91600d1c2
commit 7aa772f03e
8 changed files with 153 additions and 91 deletions

View File

@ -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)
@ -141,6 +141,21 @@ UnlockRelationId(LockRelId *relid, LOCKMODE lockmode)
LockRelease(&tag, lockmode, false);
}
/*
* 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
*