Commit b75fcf93 authored by Bruce Momjian's avatar Bruce Momjian

Complete TODO item:

* -HOLDER/HOLDERTAB rename to PROCLOCK/PROCLOCKTAG
parent 97377048
This diff is collapsed.
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/deadlock.c,v 1.11 2002/07/18 23:06:19 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/deadlock.c,v 1.12 2002/07/19 00:17:40 momjian Exp $
* *
* Interface: * Interface:
* *
...@@ -377,7 +377,7 @@ FindLockCycleRecurse(PGPROC *checkProc, ...@@ -377,7 +377,7 @@ FindLockCycleRecurse(PGPROC *checkProc,
{ {
PGPROC *proc; PGPROC *proc;
LOCK *lock; LOCK *lock;
HOLDER *holder; PROCLOCK *holder;
SHM_QUEUE *lockHolders; SHM_QUEUE *lockHolders;
LOCKMETHODTABLE *lockMethodTable; LOCKMETHODTABLE *lockMethodTable;
PROC_QUEUE *waitQueue; PROC_QUEUE *waitQueue;
...@@ -427,8 +427,8 @@ FindLockCycleRecurse(PGPROC *checkProc, ...@@ -427,8 +427,8 @@ FindLockCycleRecurse(PGPROC *checkProc,
*/ */
lockHolders = &(lock->lockHolders); lockHolders = &(lock->lockHolders);
holder = (HOLDER *) SHMQueueNext(lockHolders, lockHolders, holder = (PROCLOCK *) SHMQueueNext(lockHolders, lockHolders,
offsetof(HOLDER, lockLink)); offsetof(PROCLOCK, lockLink));
while (holder) while (holder)
{ {
...@@ -451,8 +451,8 @@ FindLockCycleRecurse(PGPROC *checkProc, ...@@ -451,8 +451,8 @@ FindLockCycleRecurse(PGPROC *checkProc,
} }
} }
holder = (HOLDER *) SHMQueueNext(lockHolders, &holder->lockLink, holder = (PROCLOCK *) SHMQueueNext(lockHolders, &holder->lockLink,
offsetof(HOLDER, 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.123 2002/07/18 23:06:20 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.124 2002/07/19 00:17:40 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -501,7 +501,7 @@ int ...@@ -501,7 +501,7 @@ int
ProcSleep(LOCKMETHODTABLE *lockMethodTable, ProcSleep(LOCKMETHODTABLE *lockMethodTable,
LOCKMODE lockmode, LOCKMODE lockmode,
LOCK *lock, LOCK *lock,
HOLDER *holder) PROCLOCK *holder)
{ {
LWLockId masterLock = lockMethodTable->masterLock; LWLockId masterLock = lockMethodTable->masterLock;
PROC_QUEUE *waitQueue = &(lock->waitProcs); PROC_QUEUE *waitQueue = &(lock->waitProcs);
......
...@@ -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.62 2002/07/18 23:06:20 momjian Exp $ * $Id: lock.h,v 1.63 2002/07/19 00:17:40 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -130,7 +130,7 @@ typedef struct LOCKTAG ...@@ -130,7 +130,7 @@ typedef struct LOCKTAG
* tag -- uniquely identifies the object being locked * tag -- uniquely identifies the object being locked
* grantMask -- bitmask for all lock types currently granted on this object. * grantMask -- bitmask for all lock types currently granted on this object.
* waitMask -- bitmask for all lock types currently awaited on this object. * waitMask -- bitmask for all lock types currently awaited on this object.
* lockHolders -- list of HOLDER objects for this lock. * lockHolders -- list of PROCLOCK objects for this lock.
* waitProcs -- queue of processes waiting for this lock. * waitProcs -- queue of processes waiting for this lock.
* requested -- count of each lock type currently requested on the lock * requested -- count of each lock type currently requested on the lock
* (includes requests already granted!!). * (includes requests already granted!!).
...@@ -146,7 +146,7 @@ typedef struct LOCK ...@@ -146,7 +146,7 @@ typedef struct LOCK
/* data */ /* data */
int grantMask; /* bitmask for lock types already granted */ int grantMask; /* bitmask for lock types already granted */
int waitMask; /* bitmask for lock types awaited */ int waitMask; /* bitmask for lock types awaited */
SHM_QUEUE lockHolders; /* list of HOLDER objects assoc. with lock */ SHM_QUEUE lockHolders; /* list of PROCLOCK objects assoc. with lock */
PROC_QUEUE waitProcs; /* list of PGPROC objects waiting on lock */ PROC_QUEUE waitProcs; /* list of PGPROC objects waiting on lock */
int requested[MAX_LOCKMODES]; /* counts of requested int requested[MAX_LOCKMODES]; /* counts of requested
* locks */ * locks */
...@@ -163,8 +163,8 @@ typedef struct LOCK ...@@ -163,8 +163,8 @@ typedef struct LOCK
* on the same lockable object. We need to store some per-holder information * on the same lockable object. We need to store some per-holder information
* for each such holder (or would-be holder). * for each such holder (or would-be holder).
* *
* HOLDERTAG is the key information needed to look up a HOLDER item in the * PROCLOCKTAG is the key information needed to look up a PROCLOCK item in the
* holder hashtable. A HOLDERTAG value uniquely identifies a lock holder. * holder hashtable. A PROCLOCKTAG value uniquely identifies a lock holder.
* *
* There are two possible kinds of holder tags: a transaction (identified * There are two possible kinds of holder 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
...@@ -180,32 +180,32 @@ typedef struct LOCK ...@@ -180,32 +180,32 @@ typedef struct LOCK
* Otherwise, holder objects whose counts have gone to zero are recycled * Otherwise, holder objects whose counts have gone to zero are recycled
* as soon as convenient. * as soon as convenient.
* *
* Each HOLDER object is linked into lists for both the associated LOCK object * Each PROCLOCK object is linked into lists for both the associated LOCK object
* and the owning PGPROC object. Note that the HOLDER is entered into these * and the owning PGPROC object. Note that the PROCLOCK is entered into these
* lists as soon as it is created, even if no lock has yet been granted. * lists as soon as it is created, even if no lock has yet been granted.
* A PGPROC that is waiting for a lock to be granted will also be linked into * A PGPROC that is waiting for a lock to be granted will also be linked into
* the lock's waitProcs queue. * the lock's waitProcs queue.
*/ */
typedef struct HOLDERTAG typedef struct PROCLOCKTAG
{ {
SHMEM_OFFSET lock; /* link to per-lockable-object information */ SHMEM_OFFSET lock; /* link to per-lockable-object information */
SHMEM_OFFSET proc; /* link to PGPROC of owning backend */ SHMEM_OFFSET proc; /* link to PGPROC of owning backend */
TransactionId xid; /* xact ID, or InvalidTransactionId */ TransactionId xid; /* xact ID, or InvalidTransactionId */
} HOLDERTAG; } PROCLOCKTAG;
typedef struct HOLDER typedef struct PROCLOCK
{ {
/* tag */ /* tag */
HOLDERTAG tag; /* unique identifier of holder object */ PROCLOCKTAG tag; /* unique identifier of holder 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 holders */
SHM_QUEUE procLink; /* list link for process's list of holders */ SHM_QUEUE procLink; /* list link for process's list of holders */
} HOLDER; } PROCLOCK;
#define HOLDER_LOCKMETHOD(holder) \ #define PROCLOCK_LOCKMETHOD(holder) \
(((LOCK *) MAKE_PTR((holder).tag.lock))->tag.lockmethod) (((LOCK *) MAKE_PTR((holder).tag.lock))->tag.lockmethod)
...@@ -225,9 +225,9 @@ extern bool LockReleaseAll(LOCKMETHOD lockmethod, PGPROC *proc, ...@@ -225,9 +225,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, HOLDER *holder, PGPROC *proc, LOCK *lock, PROCLOCK *holder, PGPROC *proc,
int *myHolding); int *myHolding);
extern void GrantLock(LOCK *lock, HOLDER *holder, LOCKMODE lockmode); extern void GrantLock(LOCK *lock, PROCLOCK *holder, 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.58 2002/07/13 01:02:14 momjian Exp $ * $Id: proc.h,v 1.59 2002/07/19 00:17:40 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -61,12 +61,12 @@ struct PGPROC ...@@ -61,12 +61,12 @@ struct PGPROC
/* Info about lock the process is currently waiting for, if any. */ /* Info about lock the process is currently waiting for, if any. */
/* waitLock and waitHolder are NULL if not currently waiting. */ /* waitLock and waitHolder are NULL if not currently waiting. */
LOCK *waitLock; /* Lock object we're sleeping on ... */ LOCK *waitLock; /* Lock object we're sleeping on ... */
HOLDER *waitHolder; /* Per-holder info for awaited lock */ PROCLOCK *waitHolder; /* Per-holder info for awaited lock */
LOCKMODE waitLockMode; /* type of lock we're waiting for */ LOCKMODE waitLockMode; /* type of lock we're waiting for */
LOCKMASK heldLocks; /* bitmask for lock types already held on LOCKMASK heldLocks; /* bitmask for lock types already held on
* this lock object by this backend */ * this lock object by this backend */
SHM_QUEUE procHolders; /* list of HOLDER objects for locks held SHM_QUEUE procHolders; /* list of PROCLOCK objects for locks held
* or awaited by this backend */ * or awaited by this backend */
}; };
...@@ -101,7 +101,7 @@ extern void ProcReleaseLocks(bool isCommit); ...@@ -101,7 +101,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, HOLDER *holder); LOCK *lock, PROCLOCK *holder);
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