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 @@ ...@@ -12,7 +12,7 @@
* *
* *
* IDENTIFICATION * 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: * Interface:
* *
...@@ -425,7 +425,7 @@ FindLockCycleRecurse(PGPROC *checkProc, ...@@ -425,7 +425,7 @@ FindLockCycleRecurse(PGPROC *checkProc,
{ {
PGPROC *proc; PGPROC *proc;
LOCK *lock; LOCK *lock;
PROCLOCK *holder; PROCLOCK *proclock;
SHM_QUEUE *lockHolders; SHM_QUEUE *lockHolders;
LOCKMETHODTABLE *lockMethodTable; LOCKMETHODTABLE *lockMethodTable;
PROC_QUEUE *waitQueue; PROC_QUEUE *waitQueue;
...@@ -484,19 +484,19 @@ FindLockCycleRecurse(PGPROC *checkProc, ...@@ -484,19 +484,19 @@ FindLockCycleRecurse(PGPROC *checkProc,
*/ */
lockHolders = &(lock->lockHolders); lockHolders = &(lock->lockHolders);
holder = (PROCLOCK *) SHMQueueNext(lockHolders, lockHolders, proclock = (PROCLOCK *) SHMQueueNext(lockHolders, lockHolders,
offsetof(PROCLOCK, lockLink)); 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 */ /* A proc never blocks itself */
if (proc != checkProc) if (proc != checkProc)
{ {
for (lm = 1; lm <= numLockModes; lm++) for (lm = 1; lm <= numLockModes; lm++)
{ {
if (holder->holding[lm] > 0 && if (proclock->holding[lm] > 0 &&
((1 << lm) & conflictMask) != 0) ((1 << lm) & conflictMask) != 0)
{ {
/* This proc hard-blocks checkProc */ /* This proc hard-blocks checkProc */
...@@ -512,13 +512,13 @@ FindLockCycleRecurse(PGPROC *checkProc, ...@@ -512,13 +512,13 @@ FindLockCycleRecurse(PGPROC *checkProc,
return true; return true;
} }
/* If no deadlock, we're done looking at this holder */ /* If no deadlock, we're done looking at this proclock */
break; break;
} }
} }
} }
holder = (PROCLOCK *) SHMQueueNext(lockHolders, &holder->lockLink, proclock = (PROCLOCK *) SHMQueueNext(lockHolders, &proclock->lockLink,
offsetof(PROCLOCK, lockLink)); offsetof(PROCLOCK, lockLink));
} }
......
This diff is collapsed.
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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 ...@@ -521,7 +521,7 @@ int
ProcSleep(LOCKMETHODTABLE *lockMethodTable, ProcSleep(LOCKMETHODTABLE *lockMethodTable,
LOCKMODE lockmode, LOCKMODE lockmode,
LOCK *lock, LOCK *lock,
PROCLOCK *holder) PROCLOCK *proclock)
{ {
LWLockId masterLock = lockMethodTable->masterLock; LWLockId masterLock = lockMethodTable->masterLock;
PROC_QUEUE *waitQueue = &(lock->waitProcs); PROC_QUEUE *waitQueue = &(lock->waitProcs);
...@@ -577,12 +577,12 @@ ProcSleep(LOCKMETHODTABLE *lockMethodTable, ...@@ -577,12 +577,12 @@ ProcSleep(LOCKMETHODTABLE *lockMethodTable,
LockCheckConflicts(lockMethodTable, LockCheckConflicts(lockMethodTable,
lockmode, lockmode,
lock, lock,
holder, proclock,
MyProc, MyProc,
NULL) == STATUS_OK) NULL) == STATUS_OK)
{ {
/* Skip the wait and just grant myself the lock. */ /* Skip the wait and just grant myself the lock. */
GrantLock(lock, holder, lockmode); GrantLock(lock, proclock, lockmode);
return STATUS_OK; return STATUS_OK;
} }
/* Break out of loop to put myself before him */ /* Break out of loop to put myself before him */
...@@ -615,7 +615,7 @@ ProcSleep(LOCKMETHODTABLE *lockMethodTable, ...@@ -615,7 +615,7 @@ ProcSleep(LOCKMETHODTABLE *lockMethodTable,
/* Set up wait information in PGPROC object, too */ /* Set up wait information in PGPROC object, too */
MyProc->waitLock = lock; MyProc->waitLock = lock;
MyProc->waitHolder = holder; MyProc->waitHolder = proclock;
MyProc->waitLockMode = lockmode; MyProc->waitLockMode = lockmode;
MyProc->errType = STATUS_OK; /* initialize result for success */ MyProc->errType = STATUS_OK; /* initialize result for success */
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Copyright (c) 2002, PostgreSQL Global Development Group * Copyright (c) 2002, PostgreSQL Global Development Group
* *
* IDENTIFICATION * 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) ...@@ -88,7 +88,7 @@ pg_lock_status(PG_FUNCTION_ARGS)
while (mystatus->currIdx < lockData->nelements) while (mystatus->currIdx < lockData->nelements)
{ {
PROCLOCK *holder; PROCLOCK *proclock;
LOCK *lock; LOCK *lock;
PGPROC *proc; PGPROC *proc;
bool granted; bool granted;
...@@ -98,7 +98,7 @@ pg_lock_status(PG_FUNCTION_ARGS) ...@@ -98,7 +98,7 @@ pg_lock_status(PG_FUNCTION_ARGS)
HeapTuple tuple; HeapTuple tuple;
Datum result; Datum result;
holder = &(lockData->holders[mystatus->currIdx]); proclock = &(lockData->proclocks[mystatus->currIdx]);
lock = &(lockData->locks[mystatus->currIdx]); lock = &(lockData->locks[mystatus->currIdx]);
proc = &(lockData->procs[mystatus->currIdx]); proc = &(lockData->procs[mystatus->currIdx]);
...@@ -110,10 +110,10 @@ pg_lock_status(PG_FUNCTION_ARGS) ...@@ -110,10 +110,10 @@ pg_lock_status(PG_FUNCTION_ARGS)
granted = false; granted = false;
for (mode = 0; mode < MAX_LOCKMODES; mode++) for (mode = 0; mode < MAX_LOCKMODES; mode++)
{ {
if (holder->holding[mode] > 0) if (proclock->holding[mode] > 0)
{ {
granted = true; granted = true;
holder->holding[mode] = 0; proclock->holding[mode] = 0;
break; break;
} }
} }
...@@ -124,7 +124,7 @@ pg_lock_status(PG_FUNCTION_ARGS) ...@@ -124,7 +124,7 @@ pg_lock_status(PG_FUNCTION_ARGS)
*/ */
if (!granted) 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 */ /* Yes, so report it with proper mode */
mode = proc->waitLockMode; mode = proc->waitLockMode;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * 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; ...@@ -68,7 +68,7 @@ typedef int LOCKMETHOD;
* *
* lockHash -- hash table holding per-locked-object lock information * 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 * lockmethod -- the handle used by the lock table's clients to
* refer to the type of lock table being used. * refer to the type of lock table being used.
...@@ -86,7 +86,7 @@ typedef int LOCKMETHOD; ...@@ -86,7 +86,7 @@ typedef int LOCKMETHOD;
typedef struct LOCKMETHODTABLE typedef struct LOCKMETHODTABLE
{ {
HTAB *lockHash; HTAB *lockHash;
HTAB *holderHash; HTAB *proclockHash;
LOCKMETHOD lockmethod; LOCKMETHOD lockmethod;
int numLockModes; int numLockModes;
int conflictTab[MAX_LOCKMODES]; int conflictTab[MAX_LOCKMODES];
...@@ -156,24 +156,25 @@ typedef struct LOCK ...@@ -156,24 +156,25 @@ typedef struct LOCK
/* /*
* We may have several different transactions holding or awaiting locks * We may have several different transactions holding or awaiting locks
* on the same lockable object. We need to store some per-holder information * on the same lockable object. We need to store some per-waiter/holder
* for each such holder (or would-be holder). * information for each such holder (or would-be holder).
* *
* PROCLOCKTAG is the key information needed to look up a PROCLOCK item in the * 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 * 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). * 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 * locks obtained for VACUUM. We assume that a session lock never conflicts
* with per-transaction locks obtained by the same backend. * with per-transaction locks obtained by the same backend.
* *
* The holding[] array counts the granted locks (of each type) represented * 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. * 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. * as soon as convenient.
* *
* Each PROCLOCK object is linked into lists for both the associated LOCK object * Each PROCLOCK object is linked into lists for both the associated LOCK object
...@@ -192,17 +193,17 @@ typedef struct PROCLOCKTAG ...@@ -192,17 +193,17 @@ typedef struct PROCLOCKTAG
typedef struct PROCLOCK typedef struct PROCLOCK
{ {
/* tag */ /* tag */
PROCLOCKTAG tag; /* unique identifier of holder object */ PROCLOCKTAG tag; /* unique identifier of proclock object */
/* data */ /* data */
int holding[MAX_LOCKMODES]; /* count of locks currently held */ int holding[MAX_LOCKMODES]; /* count of locks currently held */
int nHolding; /* total of holding[] array */ int nHolding; /* total of holding[] array */
SHM_QUEUE lockLink; /* list link for lock'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 holders */ SHM_QUEUE procLink; /* list link for process's list of proclocks */
} PROCLOCK; } PROCLOCK;
#define PROCLOCK_LOCKMETHOD(holder) \ #define PROCLOCK_LOCKMETHOD(proclock) \
(((LOCK *) MAKE_PTR((holder).tag.lock))->tag.lockmethod) (((LOCK *) MAKE_PTR((proclock).tag.lock))->tag.lockmethod)
/* /*
* This struct holds information passed from lmgr internals to the lock * This struct holds information passed from lmgr internals to the lock
...@@ -215,8 +216,8 @@ typedef struct PROCLOCK ...@@ -215,8 +216,8 @@ typedef struct PROCLOCK
typedef struct typedef struct
{ {
int nelements; /* The length of each of the arrays */ int nelements; /* The length of each of the arrays */
SHMEM_OFFSET *holderaddrs; SHMEM_OFFSET *proclockaddrs;
PROCLOCK *holders; PROCLOCK *proclocks;
PGPROC *procs; PGPROC *procs;
LOCK *locks; LOCK *locks;
} LockData; } LockData;
...@@ -237,9 +238,9 @@ extern bool LockReleaseAll(LOCKMETHOD lockmethod, PGPROC *proc, ...@@ -237,9 +238,9 @@ extern bool LockReleaseAll(LOCKMETHOD lockmethod, PGPROC *proc,
bool allxids, TransactionId xid); bool allxids, TransactionId xid);
extern int LockCheckConflicts(LOCKMETHODTABLE *lockMethodTable, extern int LockCheckConflicts(LOCKMETHODTABLE *lockMethodTable,
LOCKMODE lockmode, LOCKMODE lockmode,
LOCK *lock, PROCLOCK *holder, PGPROC *proc, LOCK *lock, PROCLOCK *proclock, PGPROC *proc,
int *myHolding); 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 void RemoveFromWaitQueue(PGPROC *proc);
extern int LockShmemSize(int maxBackends); extern int LockShmemSize(int maxBackends);
extern bool DeadLockCheck(PGPROC *proc); extern bool DeadLockCheck(PGPROC *proc);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * 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); ...@@ -102,7 +102,7 @@ extern void ProcReleaseLocks(bool isCommit);
extern void ProcQueueInit(PROC_QUEUE *queue); extern void ProcQueueInit(PROC_QUEUE *queue);
extern int ProcSleep(LOCKMETHODTABLE *lockMethodTable, LOCKMODE lockmode, extern int ProcSleep(LOCKMETHODTABLE *lockMethodTable, LOCKMODE lockmode,
LOCK *lock, PROCLOCK *holder); LOCK *lock, PROCLOCK *proclock);
extern PGPROC *ProcWakeup(PGPROC *proc, int errType); extern PGPROC *ProcWakeup(PGPROC *proc, int errType);
extern void ProcLockWakeup(LOCKMETHODTABLE *lockMethodTable, LOCK *lock); extern void ProcLockWakeup(LOCKMETHODTABLE *lockMethodTable, LOCK *lock);
extern bool LockWaitCancel(void); 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