1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-30 06:01:21 +03:00

- Modifies LOCKTAG to include a 'classId'. Relation receive a classId of

RelOid_pg_class, and transaction locks XactLockTableId. RelId is renamed
to objId.

- LockObject() and UnlockObject() functions created, and their use
sprinkled throughout the code to do descent locking for domains and
types. They accept lock modes AccessShare and AccessExclusive, as we
only really need a 'read' and 'write' lock at the moment.  Most locking
cases are held until the end of the transaction.

This fixes the cases Tom mentioned earlier in regards to locking with
Domains.  If the patch is good, I'll work on cleaning up issues with
other database objects that have this problem (most of them).

Rod Taylor
This commit is contained in:
Bruce Momjian
2003-02-19 04:02:54 +00:00
parent 81f6db4803
commit d0f3a7e9c4
10 changed files with 219 additions and 73 deletions

View File

@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/deadlock.c,v 1.17 2003/02/18 02:13:24 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/deadlock.c,v 1.18 2003/02/19 04:02:53 momjian Exp $
*
* Interface:
*
@@ -855,22 +855,25 @@ DeadLockReport(void)
else
nextpid = deadlockDetails[0].pid;
if (info->locktag.relId == XactLockTableId && info->locktag.dbId == 0)
if (info->locktag.objId == InvalidOid
&& info->locktag.classId == XactLockTableId
&& info->locktag.dbId == InvalidOid)
{
/* Lock is for transaction ID */
elog(NOTICE, "Proc %d waits for %s on transaction %u; blocked by %d",
info->pid,
GetLockmodeName(info->lockmode),
info->locktag.objId.xid,
info->locktag.objsubId.xid,
nextpid);
}
else
{
/* Lock is for a relation */
elog(NOTICE, "Proc %d waits for %s on relation %u database %u; blocked by %d",
elog(NOTICE, "Proc %d waits for %s on object %u class %u database %u; blocked by %d",
info->pid,
GetLockmodeName(info->lockmode),
info->locktag.relId,
info->locktag.objId,
info->locktag.classId,
info->locktag.dbId,
nextpid);
}