Rename lockt to locktype and rename LOCKT to LOCKTYPE.
This commit is contained in:
parent
cff7e20467
commit
f21fa6a773
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.30 1998/06/27 15:47:46 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.31 1998/06/28 21:17:34 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Outside modules can create a lock table and acquire/release
|
||||
@ -52,7 +52,7 @@
|
||||
|
||||
static int
|
||||
WaitOnLock(LOCKTAB *ltable, LockTableId tableId, LOCK *lock,
|
||||
LOCKT lockt);
|
||||
LOCKTYPE locktype);
|
||||
|
||||
/*#define LOCK_MGR_DEBUG*/
|
||||
|
||||
@ -437,7 +437,7 @@ LockTableRename(LockTableId tableId)
|
||||
* xid.xid current xid 0
|
||||
* persistence transaction user or backend
|
||||
*
|
||||
* The lockt parameter can have the same values for normal locks
|
||||
* The locktype parameter can have the same values for normal locks
|
||||
* although probably only WRITE_LOCK can have some practical use.
|
||||
*
|
||||
* DZ - 4 Oct 1996
|
||||
@ -445,7 +445,7 @@ LockTableRename(LockTableId tableId)
|
||||
*/
|
||||
|
||||
bool
|
||||
LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
|
||||
LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKTYPE locktype)
|
||||
{
|
||||
XIDLookupEnt *result,
|
||||
item;
|
||||
@ -469,7 +469,7 @@ LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
|
||||
lockName->tupleId.ip_posid,
|
||||
((lockName->tupleId.ip_blkid.bi_hi << 16) +
|
||||
lockName->tupleId.ip_blkid.bi_lo),
|
||||
lockt);
|
||||
locktype);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@ -485,7 +485,7 @@ LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
|
||||
if (LockingIsDisabled)
|
||||
return (TRUE);
|
||||
|
||||
LOCK_PRINT("Acquire", lockName, lockt);
|
||||
LOCK_PRINT("Acquire", lockName, locktype);
|
||||
masterLock = ltable->ctl->masterLock;
|
||||
|
||||
SpinAcquire(masterLock);
|
||||
@ -571,7 +571,7 @@ LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
|
||||
* ----------------
|
||||
*/
|
||||
lock->nHolding++;
|
||||
lock->holders[lockt]++;
|
||||
lock->holders[locktype]++;
|
||||
|
||||
/* --------------------
|
||||
* If I'm the only one holding a lock, then there
|
||||
@ -582,19 +582,19 @@ LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
|
||||
*/
|
||||
if (result->nHolding == lock->nActive)
|
||||
{
|
||||
result->holders[lockt]++;
|
||||
result->holders[locktype]++;
|
||||
result->nHolding++;
|
||||
GrantLock(lock, lockt);
|
||||
GrantLock(lock, locktype);
|
||||
SpinRelease(masterLock);
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
Assert(result->nHolding <= lock->nActive);
|
||||
|
||||
status = LockResolveConflicts(ltable, lock, lockt, myXid);
|
||||
status = LockResolveConflicts(ltable, lock, locktype, myXid);
|
||||
|
||||
if (status == STATUS_OK)
|
||||
GrantLock(lock, lockt);
|
||||
GrantLock(lock, locktype);
|
||||
else if (status == STATUS_FOUND)
|
||||
{
|
||||
#ifdef USER_LOCKS
|
||||
@ -611,7 +611,7 @@ LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
|
||||
hash_search(xidTable, (Pointer) &item, HASH_REMOVE, &found);
|
||||
}
|
||||
lock->nHolding--;
|
||||
lock->holders[lockt]--;
|
||||
lock->holders[locktype]--;
|
||||
SpinRelease(masterLock);
|
||||
#ifdef USER_LOCKS_DEBUG
|
||||
elog(NOTICE, "LockAcquire: user lock failed");
|
||||
@ -619,7 +619,7 @@ LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
|
||||
return (FALSE);
|
||||
}
|
||||
#endif
|
||||
status = WaitOnLock(ltable, tableId, lock, lockt);
|
||||
status = WaitOnLock(ltable, tableId, lock, locktype);
|
||||
XID_PRINT("Someone granted me the lock", result);
|
||||
}
|
||||
|
||||
@ -647,7 +647,7 @@ LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
|
||||
int
|
||||
LockResolveConflicts(LOCKTAB *ltable,
|
||||
LOCK *lock,
|
||||
LOCKT lockt,
|
||||
LOCKTYPE locktype,
|
||||
TransactionId xid)
|
||||
{
|
||||
XIDLookupEnt *result,
|
||||
@ -703,7 +703,7 @@ LockResolveConflicts(LOCKTAB *ltable,
|
||||
* do not continue and share the lock, even if we can. bjm
|
||||
* ------------------------
|
||||
*/
|
||||
int myprio = ltable->ctl->prio[lockt];
|
||||
int myprio = ltable->ctl->prio[locktype];
|
||||
PROC_QUEUE *waitQueue = &(lock->waitProcs);
|
||||
PROC *topproc = (PROC *) MAKE_PTR(waitQueue->links.prev);
|
||||
|
||||
@ -716,15 +716,15 @@ LockResolveConflicts(LOCKTAB *ltable,
|
||||
* with mine, then I get the lock.
|
||||
*
|
||||
* Checking for conflict: lock->mask represents the types of
|
||||
* currently held locks. conflictTable[lockt] has a bit
|
||||
* currently held locks. conflictTable[locktype] has a bit
|
||||
* set for each type of lock that conflicts with mine. Bitwise
|
||||
* compare tells if there is a conflict.
|
||||
* ----------------------------
|
||||
*/
|
||||
if (!(ltable->ctl->conflictTab[lockt] & lock->mask))
|
||||
if (!(ltable->ctl->conflictTab[locktype] & lock->mask))
|
||||
{
|
||||
|
||||
result->holders[lockt]++;
|
||||
result->holders[locktype]++;
|
||||
result->nHolding++;
|
||||
|
||||
XID_PRINT("Conflict Resolved: updated xid entry stats", result);
|
||||
@ -753,12 +753,12 @@ LockResolveConflicts(LOCKTAB *ltable,
|
||||
* conflict and I have to sleep.
|
||||
* ------------------------
|
||||
*/
|
||||
if (!(ltable->ctl->conflictTab[lockt] & bitmask))
|
||||
if (!(ltable->ctl->conflictTab[locktype] & bitmask))
|
||||
{
|
||||
|
||||
/* no conflict. Get the lock and go on */
|
||||
|
||||
result->holders[lockt]++;
|
||||
result->holders[locktype]++;
|
||||
result->nHolding++;
|
||||
|
||||
XID_PRINT("Conflict Resolved: updated xid entry stats", result);
|
||||
@ -771,11 +771,11 @@ LockResolveConflicts(LOCKTAB *ltable,
|
||||
}
|
||||
|
||||
static int
|
||||
WaitOnLock(LOCKTAB *ltable, LockTableId tableId, LOCK *lock, LOCKT lockt)
|
||||
WaitOnLock(LOCKTAB *ltable, LockTableId tableId, LOCK *lock, LOCKTYPE locktype)
|
||||
{
|
||||
PROC_QUEUE *waitQueue = &(lock->waitProcs);
|
||||
|
||||
int prio = ltable->ctl->prio[lockt];
|
||||
int prio = ltable->ctl->prio[locktype];
|
||||
|
||||
/*
|
||||
* the waitqueue is ordered by priority. I insert myself according to
|
||||
@ -785,10 +785,10 @@ WaitOnLock(LOCKTAB *ltable, LockTableId tableId, LOCK *lock, LOCKT lockt)
|
||||
* synchronization for this queue. That will not be true if/when
|
||||
* people can be deleted from the queue by a SIGINT or something.
|
||||
*/
|
||||
LOCK_DUMP_AUX("WaitOnLock: sleeping on lock", lock, lockt);
|
||||
LOCK_DUMP_AUX("WaitOnLock: sleeping on lock", lock, locktype);
|
||||
if (ProcSleep(waitQueue,
|
||||
ltable->ctl->masterLock,
|
||||
lockt,
|
||||
locktype,
|
||||
prio,
|
||||
lock) != NO_ERROR)
|
||||
{
|
||||
@ -799,13 +799,13 @@ WaitOnLock(LOCKTAB *ltable, LockTableId tableId, LOCK *lock, LOCKT lockt)
|
||||
* -------------------
|
||||
*/
|
||||
lock->nHolding--;
|
||||
lock->holders[lockt]--;
|
||||
LOCK_DUMP_AUX("WaitOnLock: aborting on lock", lock, lockt);
|
||||
lock->holders[locktype]--;
|
||||
LOCK_DUMP_AUX("WaitOnLock: aborting on lock", lock, locktype);
|
||||
SpinRelease(ltable->ctl->masterLock);
|
||||
elog(ERROR, "WaitOnLock: error on wakeup - Aborting this transaction");
|
||||
}
|
||||
|
||||
LOCK_DUMP_AUX("WaitOnLock: wakeup on lock", lock, lockt);
|
||||
LOCK_DUMP_AUX("WaitOnLock: wakeup on lock", lock, locktype);
|
||||
return (STATUS_OK);
|
||||
}
|
||||
|
||||
@ -820,7 +820,7 @@ WaitOnLock(LOCKTAB *ltable, LockTableId tableId, LOCK *lock, LOCKT lockt)
|
||||
* come along and request the lock).
|
||||
*/
|
||||
bool
|
||||
LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
|
||||
LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKTYPE locktype)
|
||||
{
|
||||
LOCK *lock = NULL;
|
||||
SPINLOCK masterLock;
|
||||
@ -843,7 +843,7 @@ LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
|
||||
lockName->tupleId.ip_posid,
|
||||
((lockName->tupleId.ip_blkid.bi_hi << 16) +
|
||||
lockName->tupleId.ip_blkid.bi_lo),
|
||||
lockt);
|
||||
locktype);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@ -859,7 +859,7 @@ LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
|
||||
if (LockingIsDisabled)
|
||||
return (TRUE);
|
||||
|
||||
LOCK_PRINT("Release", lockName, lockt);
|
||||
LOCK_PRINT("Release", lockName, locktype);
|
||||
|
||||
masterLock = ltable->ctl->masterLock;
|
||||
xidTable = ltable->xidHash;
|
||||
@ -919,9 +919,9 @@ LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
|
||||
* fix the general lock stats
|
||||
*/
|
||||
lock->nHolding--;
|
||||
lock->holders[lockt]--;
|
||||
lock->holders[locktype]--;
|
||||
lock->nActive--;
|
||||
lock->activeHolders[lockt]--;
|
||||
lock->activeHolders[locktype]--;
|
||||
|
||||
Assert(lock->nActive >= 0);
|
||||
|
||||
@ -992,7 +992,7 @@ LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
|
||||
* now check to see if I have any private locks. If I do, decrement
|
||||
* the counts associated with them.
|
||||
*/
|
||||
result->holders[lockt]--;
|
||||
result->holders[locktype]--;
|
||||
result->nHolding--;
|
||||
|
||||
XID_PRINT("LockRelease updated xid stats", result);
|
||||
@ -1038,9 +1038,9 @@ LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
|
||||
* fix the general lock stats
|
||||
*/
|
||||
lock->nHolding--;
|
||||
lock->holders[lockt]--;
|
||||
lock->holders[locktype]--;
|
||||
lock->nActive--;
|
||||
lock->activeHolders[lockt]--;
|
||||
lock->activeHolders[locktype]--;
|
||||
|
||||
Assert(lock->nActive >= 0);
|
||||
|
||||
@ -1069,10 +1069,10 @@ LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
|
||||
* with the remaining locks.
|
||||
* --------------------------
|
||||
*/
|
||||
if (!(lock->activeHolders[lockt]))
|
||||
if (!(lock->activeHolders[locktype]))
|
||||
{
|
||||
/* change the conflict mask. No more of this lock type. */
|
||||
lock->mask &= BITS_OFF[lockt];
|
||||
lock->mask &= BITS_OFF[locktype];
|
||||
}
|
||||
|
||||
if (wakeupNeeded)
|
||||
@ -1095,11 +1095,11 @@ LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
|
||||
* the new lock holder.
|
||||
*/
|
||||
void
|
||||
GrantLock(LOCK *lock, LOCKT lockt)
|
||||
GrantLock(LOCK *lock, LOCKTYPE locktype)
|
||||
{
|
||||
lock->nActive++;
|
||||
lock->activeHolders[lockt]++;
|
||||
lock->mask |= BITS_ON[lockt];
|
||||
lock->activeHolders[locktype]++;
|
||||
lock->mask |= BITS_ON[locktype];
|
||||
}
|
||||
|
||||
#ifdef USER_LOCKS
|
||||
|
@ -12,7 +12,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/multi.c,v 1.17 1998/06/27 04:53:38 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/multi.c,v 1.18 1998/06/28 21:17:35 momjian Exp $
|
||||
*
|
||||
* NOTES:
|
||||
* (1) The lock.c module assumes that the caller here is doing
|
||||
@ -30,10 +30,10 @@
|
||||
#include "miscadmin.h" /* MyDatabaseId */
|
||||
|
||||
static bool
|
||||
MultiAcquire(LockTableId tableId, LOCKTAG *tag, LOCKT lockt,
|
||||
MultiAcquire(LockTableId tableId, LOCKTAG *tag, LOCKTYPE locktype,
|
||||
PG_LOCK_LEVEL level);
|
||||
static bool
|
||||
MultiRelease(LockTableId tableId, LOCKTAG *tag, LOCKT lockt,
|
||||
MultiRelease(LockTableId tableId, LOCKTAG *tag, LOCKTYPE locktype,
|
||||
PG_LOCK_LEVEL level);
|
||||
|
||||
/*
|
||||
@ -111,7 +111,7 @@ InitMultiLevelLocks()
|
||||
* Returns: TRUE if the lock can be set, FALSE otherwise.
|
||||
*/
|
||||
bool
|
||||
MultiLockReln(LockInfo linfo, LOCKT lockt)
|
||||
MultiLockReln(LockInfo linfo, LOCKTYPE locktype)
|
||||
{
|
||||
LOCKTAG tag;
|
||||
|
||||
@ -122,7 +122,7 @@ MultiLockReln(LockInfo linfo, LOCKT lockt)
|
||||
MemSet(&tag, 0, sizeof(tag));
|
||||
tag.relId = linfo->lRelId.relId;
|
||||
tag.dbId = linfo->lRelId.dbId;
|
||||
return (MultiAcquire(MultiTableId, &tag, lockt, RELN_LEVEL));
|
||||
return (MultiAcquire(MultiTableId, &tag, locktype, RELN_LEVEL));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -134,7 +134,7 @@ MultiLockReln(LockInfo linfo, LOCKT lockt)
|
||||
* at the page and relation level.
|
||||
*/
|
||||
bool
|
||||
MultiLockTuple(LockInfo linfo, ItemPointer tidPtr, LOCKT lockt)
|
||||
MultiLockTuple(LockInfo linfo, ItemPointer tidPtr, LOCKTYPE locktype)
|
||||
{
|
||||
LOCKTAG tag;
|
||||
|
||||
@ -149,14 +149,14 @@ MultiLockTuple(LockInfo linfo, ItemPointer tidPtr, LOCKT lockt)
|
||||
|
||||
/* not locking any valid Tuple, just the page */
|
||||
tag.tupleId = *tidPtr;
|
||||
return (MultiAcquire(MultiTableId, &tag, lockt, TUPLE_LEVEL));
|
||||
return (MultiAcquire(MultiTableId, &tag, locktype, TUPLE_LEVEL));
|
||||
}
|
||||
|
||||
/*
|
||||
* same as above at page level
|
||||
*/
|
||||
bool
|
||||
MultiLockPage(LockInfo linfo, ItemPointer tidPtr, LOCKT lockt)
|
||||
MultiLockPage(LockInfo linfo, ItemPointer tidPtr, LOCKTYPE locktype)
|
||||
{
|
||||
LOCKTAG tag;
|
||||
|
||||
@ -179,7 +179,7 @@ MultiLockPage(LockInfo linfo, ItemPointer tidPtr, LOCKT lockt)
|
||||
tag.relId = linfo->lRelId.relId;
|
||||
tag.dbId = linfo->lRelId.dbId;
|
||||
BlockIdCopy(&(tag.tupleId.ip_blkid), &(tidPtr->ip_blkid));
|
||||
return (MultiAcquire(MultiTableId, &tag, lockt, PAGE_LEVEL));
|
||||
return (MultiAcquire(MultiTableId, &tag, locktype, PAGE_LEVEL));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -191,10 +191,10 @@ MultiLockPage(LockInfo linfo, ItemPointer tidPtr, LOCKT lockt)
|
||||
static bool
|
||||
MultiAcquire(LockTableId tableId,
|
||||
LOCKTAG *tag,
|
||||
LOCKT lockt,
|
||||
LOCKTYPE locktype,
|
||||
PG_LOCK_LEVEL level)
|
||||
{
|
||||
LOCKT locks[N_LEVELS];
|
||||
LOCKTYPE locks[N_LEVELS];
|
||||
int i,
|
||||
status;
|
||||
LOCKTAG xxTag,
|
||||
@ -213,19 +213,19 @@ MultiAcquire(LockTableId tableId,
|
||||
switch (level)
|
||||
{
|
||||
case RELN_LEVEL:
|
||||
locks[0] = lockt;
|
||||
locks[0] = locktype;
|
||||
locks[1] = NO_LOCK;
|
||||
locks[2] = NO_LOCK;
|
||||
break;
|
||||
case PAGE_LEVEL:
|
||||
locks[0] = lockt + INTENT;
|
||||
locks[1] = lockt;
|
||||
locks[0] = locktype + INTENT;
|
||||
locks[1] = locktype;
|
||||
locks[2] = NO_LOCK;
|
||||
break;
|
||||
case TUPLE_LEVEL:
|
||||
locks[0] = lockt + INTENT;
|
||||
locks[1] = lockt + INTENT;
|
||||
locks[2] = lockt;
|
||||
locks[0] = locktype + INTENT;
|
||||
locks[1] = locktype + INTENT;
|
||||
locks[2] = locktype;
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "MultiAcquire: bad lock level");
|
||||
@ -285,7 +285,7 @@ MultiAcquire(LockTableId tableId,
|
||||
* the last level lock we successfully acquired
|
||||
*/
|
||||
retStatus = FALSE;
|
||||
MultiRelease(tableId, tag, lockt, i);
|
||||
MultiRelease(tableId, tag, locktype, i);
|
||||
/* now leave the loop. Don't try for any more locks */
|
||||
break;
|
||||
}
|
||||
@ -300,7 +300,7 @@ MultiAcquire(LockTableId tableId,
|
||||
*/
|
||||
#ifdef NOT_USED
|
||||
bool
|
||||
MultiReleasePage(LockInfo linfo, ItemPointer tidPtr, LOCKT lockt)
|
||||
MultiReleasePage(LockInfo linfo, ItemPointer tidPtr, LOCKTYPE locktype)
|
||||
{
|
||||
LOCKTAG tag;
|
||||
|
||||
@ -316,7 +316,7 @@ MultiReleasePage(LockInfo linfo, ItemPointer tidPtr, LOCKT lockt)
|
||||
tag.dbId = linfo->lRelId.dbId;
|
||||
BlockIdCopy(&(tag.tupleId.ip_blkid), &(tidPtr->ip_blkid));
|
||||
|
||||
return (MultiRelease(MultiTableId, &tag, lockt, PAGE_LEVEL));
|
||||
return (MultiRelease(MultiTableId, &tag, locktype, PAGE_LEVEL));
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -326,7 +326,7 @@ MultiReleasePage(LockInfo linfo, ItemPointer tidPtr, LOCKT lockt)
|
||||
* ------------------
|
||||
*/
|
||||
bool
|
||||
MultiReleaseReln(LockInfo linfo, LOCKT lockt)
|
||||
MultiReleaseReln(LockInfo linfo, LOCKTYPE locktype)
|
||||
{
|
||||
LOCKTAG tag;
|
||||
|
||||
@ -340,7 +340,7 @@ MultiReleaseReln(LockInfo linfo, LOCKT lockt)
|
||||
tag.relId = linfo->lRelId.relId;
|
||||
tag.dbId = linfo->lRelId.dbId;
|
||||
|
||||
return (MultiRelease(MultiTableId, &tag, lockt, RELN_LEVEL));
|
||||
return (MultiRelease(MultiTableId, &tag, locktype, RELN_LEVEL));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -351,10 +351,10 @@ MultiReleaseReln(LockInfo linfo, LOCKT lockt)
|
||||
static bool
|
||||
MultiRelease(LockTableId tableId,
|
||||
LOCKTAG *tag,
|
||||
LOCKT lockt,
|
||||
LOCKTYPE locktype,
|
||||
PG_LOCK_LEVEL level)
|
||||
{
|
||||
LOCKT locks[N_LEVELS];
|
||||
LOCKTYPE locks[N_LEVELS];
|
||||
int i,
|
||||
status;
|
||||
LOCKTAG xxTag,
|
||||
@ -366,22 +366,22 @@ MultiRelease(LockTableId tableId,
|
||||
switch (level)
|
||||
{
|
||||
case RELN_LEVEL:
|
||||
locks[0] = lockt;
|
||||
locks[0] = locktype;
|
||||
locks[1] = NO_LOCK;
|
||||
locks[2] = NO_LOCK;
|
||||
break;
|
||||
case PAGE_LEVEL:
|
||||
locks[0] = lockt + INTENT;
|
||||
locks[1] = lockt;
|
||||
locks[0] = locktype + INTENT;
|
||||
locks[1] = locktype;
|
||||
locks[2] = NO_LOCK;
|
||||
break;
|
||||
case TUPLE_LEVEL:
|
||||
locks[0] = lockt + INTENT;
|
||||
locks[1] = lockt + INTENT;
|
||||
locks[2] = lockt;
|
||||
locks[0] = locktype + INTENT;
|
||||
locks[1] = locktype + INTENT;
|
||||
locks[2] = locktype;
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "MultiRelease: bad lockt");
|
||||
elog(ERROR, "MultiRelease: bad locktype");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/single.c,v 1.5 1997/09/18 20:21:40 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/single.c,v 1.6 1998/06/28 21:17:35 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
* Returns: TRUE if the lock can be set, FALSE otherwise.
|
||||
*/
|
||||
bool
|
||||
SingleLockReln(LockInfo linfo, LOCKT lockt, int action)
|
||||
SingleLockReln(LockInfo linfo, LOCKTYPE locktype, int action)
|
||||
{
|
||||
LOCKTAG tag;
|
||||
|
||||
@ -47,9 +47,9 @@ SingleLockReln(LockInfo linfo, LOCKT lockt, int action)
|
||||
tag.tupleId.ip_posid = InvalidOffsetNumber;
|
||||
|
||||
if (action == UNLOCK)
|
||||
return (LockRelease(MultiTableId, &tag, lockt));
|
||||
return (LockRelease(MultiTableId, &tag, locktype));
|
||||
else
|
||||
return (LockAcquire(MultiTableId, &tag, lockt));
|
||||
return (LockAcquire(MultiTableId, &tag, locktype));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -63,7 +63,7 @@ SingleLockReln(LockInfo linfo, LOCKT lockt, int action)
|
||||
bool
|
||||
SingleLockPage(LockInfo linfo,
|
||||
ItemPointer tidPtr,
|
||||
LOCKT lockt,
|
||||
LOCKTYPE locktype,
|
||||
int action)
|
||||
{
|
||||
LOCKTAG tag;
|
||||
@ -80,7 +80,7 @@ SingleLockPage(LockInfo linfo,
|
||||
|
||||
|
||||
if (action == UNLOCK)
|
||||
return (LockRelease(MultiTableId, &tag, lockt));
|
||||
return (LockRelease(MultiTableId, &tag, locktype));
|
||||
else
|
||||
return (LockAcquire(MultiTableId, &tag, lockt));
|
||||
return (LockAcquire(MultiTableId, &tag, locktype));
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: lmgr.h,v 1.10 1998/02/26 04:43:27 momjian Exp $
|
||||
* $Id: lmgr.h,v 1.11 1998/06/28 21:17:35 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -72,10 +72,10 @@ extern void RelationSetWIntentLock(Relation relation);
|
||||
extern void RelationUnsetWIntentLock(Relation relation);
|
||||
|
||||
/* single.c */
|
||||
extern bool SingleLockReln(LockInfo linfo, LOCKT lockt, int action);
|
||||
extern bool SingleLockReln(LockInfo linfo, LOCKTYPE locktype, int action);
|
||||
extern bool
|
||||
SingleLockPage(LockInfo linfo, ItemPointer tidPtr,
|
||||
LOCKT lockt, int action);
|
||||
LOCKTYPE locktype, int action);
|
||||
|
||||
/* proc.c */
|
||||
extern void InitProcGlobal(IPCKey key);
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: lock.h,v 1.13 1998/06/26 01:58:46 momjian Exp $
|
||||
* $Id: lock.h,v 1.14 1998/06/28 21:17:35 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -37,7 +37,7 @@ typedef int MASK;
|
||||
#define NLOCKENTS NLOCKS_PER_XACT*NBACKENDS
|
||||
|
||||
typedef int LOCK_TYPE;
|
||||
typedef int LOCKT;
|
||||
typedef int LOCKTYPE;
|
||||
typedef int LockTableId;
|
||||
|
||||
/* MAX_LOCKTYPES cannot be larger than the bits in MASK */
|
||||
@ -190,10 +190,10 @@ typedef struct Lock
|
||||
|
||||
#define LockGetLock_nHolders(l) l->nHolders
|
||||
|
||||
#define LockDecrWaitHolders(lock, lockt) \
|
||||
#define LockDecrWaitHolders(lock, locktype) \
|
||||
( \
|
||||
lock->nHolding--, \
|
||||
lock->holders[lockt]-- \
|
||||
lock->holders[locktype]-- \
|
||||
)
|
||||
|
||||
#define LockLockTable() SpinAcquire(LockMgrLock);
|
||||
@ -209,12 +209,12 @@ extern void LockDisable(int status);
|
||||
extern LockTableId
|
||||
LockTableInit(char *tabName, MASK *conflictsP, int *prioP,
|
||||
int ntypes);
|
||||
extern bool LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt);
|
||||
extern bool LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKTYPE locktype);
|
||||
extern int
|
||||
LockResolveConflicts(LOCKTAB *ltable, LOCK *lock, LOCKT lockt,
|
||||
LockResolveConflicts(LOCKTAB *ltable, LOCK *lock, LOCKTYPE locktype,
|
||||
TransactionId xid);
|
||||
extern bool LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt);
|
||||
extern void GrantLock(LOCK *lock, LOCKT lockt);
|
||||
extern bool LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKTYPE locktype);
|
||||
extern void GrantLock(LOCK *lock, LOCKTYPE locktype);
|
||||
extern bool LockReleaseAll(LockTableId tableId, SHM_QUEUE *lockQueue);
|
||||
extern int LockShmemSize(void);
|
||||
extern bool LockingDisabled(void);
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: multilev.h,v 1.8 1998/06/26 19:57:50 momjian Exp $
|
||||
* $Id: multilev.h,v 1.9 1998/06/28 21:17:36 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -50,9 +50,9 @@ extern LockTableId ShortTermTableId;
|
||||
* function prototypes
|
||||
*/
|
||||
extern LockTableId InitMultiLevelLocks(void);
|
||||
extern bool MultiLockReln(LockInfo linfo, LOCKT lockt);
|
||||
extern bool MultiLockTuple(LockInfo linfo, ItemPointer tidPtr, LOCKT lockt);
|
||||
extern bool MultiLockPage(LockInfo linfo, ItemPointer tidPtr, LOCKT lockt);
|
||||
extern bool MultiReleaseReln(LockInfo linfo, LOCKT lockt);
|
||||
extern bool MultiLockReln(LockInfo linfo, LOCKTYPE locktype);
|
||||
extern bool MultiLockTuple(LockInfo linfo, ItemPointer tidPtr, LOCKTYPE locktype);
|
||||
extern bool MultiLockPage(LockInfo linfo, ItemPointer tidPtr, LOCKTYPE locktype);
|
||||
extern bool MultiReleaseReln(LockInfo linfo, LOCKTYPE locktype);
|
||||
|
||||
#endif /* MULTILEV_H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user