Commit 32cc6cbe authored by Bruce Momjian's avatar Bruce Momjian

Rename 'holder' references to 'proclock' for PROCLOCK references, for

consistency.
parent cf55ee57
......@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/deadlock.c,v 1.16 2003/01/16 21:01:44 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/deadlock.c,v 1.17 2003/02/18 02:13:24 momjian Exp $
*
* Interface:
*
......@@ -425,7 +425,7 @@ FindLockCycleRecurse(PGPROC *checkProc,
{
PGPROC *proc;
LOCK *lock;
PROCLOCK *holder;
PROCLOCK *proclock;
SHM_QUEUE *lockHolders;
LOCKMETHODTABLE *lockMethodTable;
PROC_QUEUE *waitQueue;
......@@ -484,19 +484,19 @@ FindLockCycleRecurse(PGPROC *checkProc,
*/
lockHolders = &(lock->lockHolders);
holder = (PROCLOCK *) SHMQueueNext(lockHolders, lockHolders,
proclock = (PROCLOCK *) SHMQueueNext(lockHolders, lockHolders,
offsetof(PROCLOCK, lockLink));
while (holder)
while (proclock)
{
proc = (PGPROC *) MAKE_PTR(holder->tag.proc);
proc = (PGPROC *) MAKE_PTR(proclock->tag.proc);
/* A proc never blocks itself */
if (proc != checkProc)
{
for (lm = 1; lm <= numLockModes; lm++)
{
if (holder->holding[lm] > 0 &&
if (proclock->holding[lm] > 0 &&
((1 << lm) & conflictMask) != 0)
{
/* This proc hard-blocks checkProc */
......@@ -512,13 +512,13 @@ FindLockCycleRecurse(PGPROC *checkProc,
return true;
}
/* If no deadlock, we're done looking at this holder */
/* If no deadlock, we're done looking at this proclock */
break;
}
}
}
holder = (PROCLOCK *) SHMQueueNext(lockHolders, &holder->lockLink,
proclock = (PROCLOCK *) SHMQueueNext(lockHolders, &proclock->lockLink,
offsetof(PROCLOCK, lockLink));
}
......
This diff is collapsed.
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.128 2003/01/16 21:01:44 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.129 2003/02/18 02:13:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -521,7 +521,7 @@ int
ProcSleep(LOCKMETHODTABLE *lockMethodTable,
LOCKMODE lockmode,
LOCK *lock,
PROCLOCK *holder)
PROCLOCK *proclock)
{
LWLockId masterLock = lockMethodTable->masterLock;
PROC_QUEUE *waitQueue = &(lock->waitProcs);
......@@ -577,12 +577,12 @@ ProcSleep(LOCKMETHODTABLE *lockMethodTable,
LockCheckConflicts(lockMethodTable,
lockmode,
lock,
holder,
proclock,
MyProc,
NULL) == STATUS_OK)
{
/* Skip the wait and just grant myself the lock. */
GrantLock(lock, holder, lockmode);
GrantLock(lock, proclock, lockmode);
return STATUS_OK;
}
/* Break out of loop to put myself before him */
......@@ -615,7 +615,7 @@ ProcSleep(LOCKMETHODTABLE *lockMethodTable,
/* Set up wait information in PGPROC object, too */
MyProc->waitLock = lock;
MyProc->waitHolder = holder;
MyProc->waitHolder = proclock;
MyProc->waitLockMode = lockmode;
MyProc->errType = STATUS_OK; /* initialize result for success */
......
......@@ -6,7 +6,7 @@
* Copyright (c) 2002, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/lockfuncs.c,v 1.7 2002/09/04 20:31:28 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/lockfuncs.c,v 1.8 2003/02/18 02:13:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -88,7 +88,7 @@ pg_lock_status(PG_FUNCTION_ARGS)
while (mystatus->currIdx < lockData->nelements)
{
PROCLOCK *holder;
PROCLOCK *proclock;
LOCK *lock;
PGPROC *proc;
bool granted;
......@@ -98,7 +98,7 @@ pg_lock_status(PG_FUNCTION_ARGS)
HeapTuple tuple;
Datum result;
holder = &(lockData->holders[mystatus->currIdx]);
proclock = &(lockData->proclocks[mystatus->currIdx]);
lock = &(lockData->locks[mystatus->currIdx]);
proc = &(lockData->procs[mystatus->currIdx]);
......@@ -110,10 +110,10 @@ pg_lock_status(PG_FUNCTION_ARGS)
granted = false;
for (mode = 0; mode < MAX_LOCKMODES; mode++)
{
if (holder->holding[mode] > 0)
if (proclock->holding[mode] > 0)
{
granted = true;
holder->holding[mode] = 0;
proclock->holding[mode] = 0;
break;
}
}
......@@ -124,7 +124,7 @@ pg_lock_status(PG_FUNCTION_ARGS)
*/
if (!granted)
{
if (proc->waitLock == (LOCK *) MAKE_PTR(holder->tag.lock))
if (proc->waitLock == (LOCK *) MAKE_PTR(proclock->tag.lock))
{
/* Yes, so report it with proper mode */
mode = proc->waitLockMode;
......
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: lock.h,v 1.68 2003/01/16 21:01:45 tgl Exp $
* $Id: lock.h,v 1.69 2003/02/18 02:13:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -68,7 +68,7 @@ typedef int LOCKMETHOD;
*
* lockHash -- hash table holding per-locked-object lock information
*
* holderHash -- hash table holding per-lock-holder lock information
* proclockHash -- hash table holding per-lock-waiter/holder lock information
*
* lockmethod -- the handle used by the lock table's clients to
* refer to the type of lock table being used.
......@@ -86,7 +86,7 @@ typedef int LOCKMETHOD;
typedef struct LOCKMETHODTABLE
{
HTAB *lockHash;
HTAB *holderHash;
HTAB *proclockHash;
LOCKMETHOD lockmethod;
int numLockModes;
int conflictTab[MAX_LOCKMODES];
......@@ -156,24 +156,25 @@ typedef struct LOCK
/*
* We may have several different transactions holding or awaiting locks
* on the same lockable object. We need to store some per-holder information
* for each such holder (or would-be holder).
* on the same lockable object. We need to store some per-waiter/holder
* information for each such holder (or would-be holder).
*
* PROCLOCKTAG is the key information needed to look up a PROCLOCK item in the
* holder hashtable. A PROCLOCKTAG value uniquely identifies a lock holder.
* proclock hashtable. A PROCLOCKTAG value uniquely identifies a lock
* holder/waiter.
*
* There are two possible kinds of holder tags: a transaction (identified
* There are two possible kinds of proclock tags: a transaction (identified
* both by the PGPROC of the backend running it, and the xact's own ID) and
* a session (identified by backend PGPROC, with xid = InvalidTransactionId).
*
* Currently, session holders are used for user locks and for cross-xact
* Currently, session proclocks are used for user locks and for cross-xact
* locks obtained for VACUUM. We assume that a session lock never conflicts
* with per-transaction locks obtained by the same backend.
*
* The holding[] array counts the granted locks (of each type) represented
* by this holder. Note that there will be a holder object, possibly with
* by this proclock. Note that there will be a proclock object, possibly with
* zero holding[], for any lock that the process is currently waiting on.
* Otherwise, holder objects whose counts have gone to zero are recycled
* Otherwise, proclock objects whose counts have gone to zero are recycled
* as soon as convenient.
*
* Each PROCLOCK object is linked into lists for both the associated LOCK object
......@@ -192,17 +193,17 @@ typedef struct PROCLOCKTAG
typedef struct PROCLOCK
{
/* tag */
PROCLOCKTAG tag; /* unique identifier of holder object */
PROCLOCKTAG tag; /* unique identifier of proclock object */
/* data */
int holding[MAX_LOCKMODES]; /* count of locks currently held */
int nHolding; /* total of holding[] array */
SHM_QUEUE lockLink; /* list link for lock's list of holders */
SHM_QUEUE procLink; /* list link for process's list of holders */
SHM_QUEUE lockLink; /* list link for lock's list of proclocks */
SHM_QUEUE procLink; /* list link for process's list of proclocks */
} PROCLOCK;
#define PROCLOCK_LOCKMETHOD(holder) \
(((LOCK *) MAKE_PTR((holder).tag.lock))->tag.lockmethod)
#define PROCLOCK_LOCKMETHOD(proclock) \
(((LOCK *) MAKE_PTR((proclock).tag.lock))->tag.lockmethod)
/*
* This struct holds information passed from lmgr internals to the lock
......@@ -215,8 +216,8 @@ typedef struct PROCLOCK
typedef struct
{
int nelements; /* The length of each of the arrays */
SHMEM_OFFSET *holderaddrs;
PROCLOCK *holders;
SHMEM_OFFSET *proclockaddrs;
PROCLOCK *proclocks;
PGPROC *procs;
LOCK *locks;
} LockData;
......@@ -237,9 +238,9 @@ extern bool LockReleaseAll(LOCKMETHOD lockmethod, PGPROC *proc,
bool allxids, TransactionId xid);
extern int LockCheckConflicts(LOCKMETHODTABLE *lockMethodTable,
LOCKMODE lockmode,
LOCK *lock, PROCLOCK *holder, PGPROC *proc,
LOCK *lock, PROCLOCK *proclock, PGPROC *proc,
int *myHolding);
extern void GrantLock(LOCK *lock, PROCLOCK *holder, LOCKMODE lockmode);
extern void GrantLock(LOCK *lock, PROCLOCK *proclock, LOCKMODE lockmode);
extern void RemoveFromWaitQueue(PGPROC *proc);
extern int LockShmemSize(int maxBackends);
extern bool DeadLockCheck(PGPROC *proc);
......
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: proc.h,v 1.62 2002/10/31 21:34:17 tgl Exp $
* $Id: proc.h,v 1.63 2003/02/18 02:13:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -102,7 +102,7 @@ extern void ProcReleaseLocks(bool isCommit);
extern void ProcQueueInit(PROC_QUEUE *queue);
extern int ProcSleep(LOCKMETHODTABLE *lockMethodTable, LOCKMODE lockmode,
LOCK *lock, PROCLOCK *holder);
LOCK *lock, PROCLOCK *proclock);
extern PGPROC *ProcWakeup(PGPROC *proc, int errType);
extern void ProcLockWakeup(LOCKMETHODTABLE *lockMethodTable, LOCK *lock);
extern bool LockWaitCancel(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment