diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/storage/buf_internals.h | 19 | ||||
-rw-r--r-- | src/include/storage/lmgr.h | 44 | ||||
-rw-r--r-- | src/include/storage/lock.h | 8 | ||||
-rw-r--r-- | src/include/storage/multilev.h | 22 |
4 files changed, 40 insertions, 53 deletions
diff --git a/src/include/storage/buf_internals.h b/src/include/storage/buf_internals.h index 0a419784f1c..03d249195d6 100644 --- a/src/include/storage/buf_internals.h +++ b/src/include/storage/buf_internals.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: buf_internals.h,v 1.24 1998/07/20 16:57:10 momjian Exp $ + * $Id: buf_internals.h,v 1.25 1998/08/01 15:26:34 vadim Exp $ * * NOTE * If BUFFERPAGE0 is defined, then 0 will be used as a @@ -65,24 +65,9 @@ struct buftag #define INIT_BUFFERTAG(a,xx_reln,xx_blockNum) \ ( \ (a)->blockNum = xx_blockNum, \ - (a)->relId = RelationGetLockRelId(xx_reln) \ + (a)->relId = ((LockInfo)(xx_reln->lockInfo))->lockRelId \ ) -#ifdef NOT_USED -#define COPY_BUFFERTAG(a,b) \ -( \ - (a)->blockNum = (b)->blockNum, \ - LockRelIdAssign(*(a),*(b)) \ -) - -#define EQUAL_BUFFERTAG(a,b) \ -( \ - ((a)->blockNum == (b)->blockNum && \ - OID_Equal((a)->relId.relId,(b)->relId.relId)) \ -) - -#endif - #define BAD_BUFFER_ID(bid) ((bid<1) || (bid>(NBuffers))) #define INVALID_DESCRIPTOR (-3) diff --git a/src/include/storage/lmgr.h b/src/include/storage/lmgr.h index 818a2f09e59..0ee53344725 100644 --- a/src/include/storage/lmgr.h +++ b/src/include/storage/lmgr.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: lmgr.h,v 1.13 1998/07/13 16:34:56 momjian Exp $ + * $Id: lmgr.h,v 1.14 1998/08/01 15:26:36 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -27,45 +27,23 @@ typedef struct LockRelId Oid dbId; /* a database identifier */ } LockRelId; +#ifdef LowLevelLocking typedef struct LockInfoData { - bool initialized; LockRelId lockRelId; - TransactionId transactionIdData; - uint16 flags; + bool lockHeld[MAX_LOCKMODES]; /* on table level */ } LockInfoData; -typedef LockInfoData *LockInfo; - -#define LockInfoIsValid(lockinfo) \ - ((PointerIsValid(lockinfo)) && ((LockInfo) lockinfo)->initialized) +#else +typedef struct LockInfoData +{ + LockRelId lockRelId; +} LockInfoData; +#endif -extern LockRelId VariableRelationLockRelId; - -/* - * RelationGetLockRelId -- - * Returns "lock" relation identifier for a relation. - */ -/* ---------------- - * final condition is a hack to prevent problems during - * VARIABLE relation initialization - * ---------------- - */ -#define RelationGetLockRelId(relation) \ -( \ - AssertMacro(RelationIsValid(relation)), \ - (!LockInfoIsValid((LockInfo)(relation)->lockInfo)) ? \ - RelationInitLockInfo(relation) \ - : \ - (void)NULL, \ - (strcmp(RelationGetRelationName(relation)->data, \ - VariableRelationName) == 0) ? \ - VariableRelationLockRelId \ - : \ - ((LockInfo)(relation)->lockInfo)->lockRelId \ -) +typedef LockInfoData *LockInfo; +#define LockInfoIsValid(lockinfo) PointerIsValid(lockinfo) -extern Oid LockRelIdGetRelationId(LockRelId lockRelId); extern void RelationInitLockInfo(Relation relation); extern void RelationSetLockForDescriptorOpen(Relation relation); extern void RelationSetLockForRead(Relation relation); diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h index 48ac1ae553d..fd1f95aab98 100644 --- a/src/include/storage/lock.h +++ b/src/include/storage/lock.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: lock.h,v 1.15 1998/06/30 02:33:33 momjian Exp $ + * $Id: lock.h,v 1.16 1998/08/01 15:26:37 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -40,7 +40,11 @@ typedef int LOCKMODE; typedef int LOCKMETHOD; /* MAX_LOCKMODES cannot be larger than the bits in MASK */ -#define MAX_LOCKMODES 6 +#ifdef LowLevelLocking +#define MAX_LOCKMODES 9 +#else +#define MAX_LOCKMODES 6 +#endif /* * MAX_LOCK_METHODS corresponds to the number of spin locks allocated in diff --git a/src/include/storage/multilev.h b/src/include/storage/multilev.h index ced76b9f426..7d3a3c983ad 100644 --- a/src/include/storage/multilev.h +++ b/src/include/storage/multilev.h @@ -7,7 +7,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: multilev.h,v 1.11 1998/07/13 16:34:58 momjian Exp $ + * $Id: multilev.h,v 1.12 1998/08/01 15:26:38 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -16,6 +16,24 @@ #include <storage/lmgr.h> +#ifdef LowLevelLocking + +/* DML locks */ +#define RowShareLock 1 /* SELECT FOR UPDATE */ +#define RowExclusiveLock 2 /* INSERT, UPDATE, DELETE */ +#define ShareLock 3 +#define ShareRowExclusiveLock 4 +#define ExclusiveLock 5 + +/* DDL locks */ +#define ObjShareLock 6 +#define ObjExclusiveLock 7 + +/* Special locks */ +#define ExtendLock 8 + +#else + #define READ_LOCK 2 #define WRITE_LOCK 1 @@ -31,6 +49,8 @@ #define EXTEND_LOCK 5 +#endif /* !LowLevelLocking */ + #define SHORT_TERM 1 #define LONG_TERM 2 #define UNLOCK 0 |