1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-06 13:46:51 +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

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.51 2003/02/09 06:56:28 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.52 2003/02/19 04:02:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,6 +23,7 @@
#include "parser/parser.h"
#include "parser/parse_expr.h"
#include "parser/parse_type.h"
#include "storage/lmgr.h"
#include "utils/builtins.h"
#include "utils/lsyscache.h"
#include "utils/syscache.h"
@@ -127,6 +128,15 @@ LookupTypeName(const TypeName *typename)
}
}
/*
* Lock the type as having been read for remainder of the transaction
*
* XXX: There is a small time between the above and now when the type
* could dissapear. We *should* recheck to confirm the type still
* exists, but won't for speed.
*/
LockObject(restype, RelOid_pg_type, AccessShareLock);
return restype;
}