diff --git a/doc/TODO b/doc/TODO index 2c4c19d01bda3bc9a7a3d1b62aa6dd92af2d9b0f..8c58cd44ed2a4157edf771baade628518acc3ef2 100644 --- a/doc/TODO +++ b/doc/TODO @@ -1,6 +1,6 @@ TODO list for PostgreSQL ======================== -Last updated: Sat Sep 29 17:34:59 EDT 2001 +Last updated: Sat Sep 29 20:43:59 EDT 2001 Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us) @@ -336,7 +336,7 @@ SOURCE CODE * Make sure all block numbers are unsigned to increase maximum table size * Use BlockNumber rather than int where appropriate * Merge LockMethodCtl and LockMethodTable into one shared structure (Bruce) -* -HOLDER/HOLDERTAB rename to PROCLOCKLINK/PROCLOCKLINKTAG (Bruce) +* HOLDER/HOLDERTAB rename to PROCLOCKLINK/PROCLOCKLINKTAG (Bruce) * Add version file format stamp to heap and other table types * -Make elog(LOG) in WAL its own output type, distinct from DEBUG (Peter E) * Rename some /contrib modules from pg* to pg_* diff --git a/src/backend/storage/lmgr/deadlock.c b/src/backend/storage/lmgr/deadlock.c index 78386febd76849598f586a53961e0548b9f7a2d2..7a550ea3464f5a99bbf2245a1349639dbf0384a2 100644 --- a/src/backend/storage/lmgr/deadlock.c +++ b/src/backend/storage/lmgr/deadlock.c @@ -12,7 +12,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/deadlock.c,v 1.5 2001/09/29 21:35:14 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/deadlock.c,v 1.6 2001/09/30 00:45:47 momjian Exp $ * * Interface: * @@ -382,7 +382,7 @@ FindLockCycleRecurse(PROC *checkProc, { PROC *proc; LOCK *lock; - PROCLOCK *holder; + HOLDER *holder; SHM_QUEUE *lockHolders; LOCKMETHODTABLE *lockMethodTable; LOCKMETHODCTL *lockctl; @@ -434,8 +434,8 @@ FindLockCycleRecurse(PROC *checkProc, */ lockHolders = &(lock->lockHolders); - holder = (PROCLOCK *) SHMQueueNext(lockHolders, lockHolders, - offsetof(PROCLOCK, lockLink)); + holder = (HOLDER *) SHMQueueNext(lockHolders, lockHolders, + offsetof(HOLDER, lockLink)); while (holder) { @@ -458,8 +458,8 @@ FindLockCycleRecurse(PROC *checkProc, } } - holder = (PROCLOCK *) SHMQueueNext(lockHolders, &holder->lockLink, - offsetof(PROCLOCK, lockLink)); + holder = (HOLDER *) SHMQueueNext(lockHolders, &holder->lockLink, + offsetof(HOLDER, lockLink)); } /* diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c index ba84f525c7b14f955073adc5f48144df071755b7..34f3c66e617ec7db22664481ac064062111a1262 100644 --- a/src/backend/storage/lmgr/lock.c +++ b/src/backend/storage/lmgr/lock.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.97 2001/09/29 21:35:14 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.98 2001/09/30 00:45:47 momjian Exp $ * * NOTES * Outside modules can create a lock table and acquire/release @@ -48,7 +48,7 @@ int max_locks_per_xact; /* set by guc.c */ static int WaitOnLock(LOCKMETHOD lockmethod, LOCKMODE lockmode, - LOCK *lock, PROCLOCK *holder); + LOCK *lock, HOLDER *holder); static void LockCountMyLocks(SHMEM_OFFSET lockOffset, PROC *proc, int *myHolding); @@ -125,18 +125,18 @@ LOCK_PRINT(const char *where, const LOCK *lock, LOCKMODE type) inline static void -PROCLOCK_PRINT(const char *where, const PROCLOCK *holderP) +HOLDER_PRINT(const char *where, const HOLDER *holderP) { if ( - (((PROCLOCK_LOCKMETHOD(*holderP) == DEFAULT_LOCKMETHOD && Trace_locks) - || (PROCLOCK_LOCKMETHOD(*holderP) == USER_LOCKMETHOD && Trace_userlocks)) + (((HOLDER_LOCKMETHOD(*holderP) == DEFAULT_LOCKMETHOD && Trace_locks) + || (HOLDER_LOCKMETHOD(*holderP) == USER_LOCKMETHOD && Trace_userlocks)) && (((LOCK *) MAKE_PTR(holderP->tag.lock))->tag.relId >= (Oid) Trace_lock_oidmin)) || (Trace_lock_table && (((LOCK *) MAKE_PTR(holderP->tag.lock))->tag.relId == Trace_lock_table)) ) elog(DEBUG, "%s: holder(%lx) lock(%lx) tbl(%d) proc(%lx) xid(%u) hold(%d,%d,%d,%d,%d,%d,%d)=%d", where, MAKE_OFFSET(holderP), holderP->tag.lock, - PROCLOCK_LOCKMETHOD(*(holderP)), + HOLDER_LOCKMETHOD(*(holderP)), holderP->tag.proc, holderP->tag.xid, holderP->holding[1], holderP->holding[2], holderP->holding[3], holderP->holding[4], holderP->holding[5], holderP->holding[6], @@ -146,7 +146,7 @@ PROCLOCK_PRINT(const char *where, const PROCLOCK *holderP) #else /* not LOCK_DEBUG */ #define LOCK_PRINT(where, lock, type) -#define PROCLOCK_PRINT(where, holderP) +#define HOLDER_PRINT(where, holderP) #endif /* not LOCK_DEBUG */ @@ -325,11 +325,11 @@ LockMethodTableInit(char *tabName, Assert(lockMethodTable->lockHash->hash == tag_hash); /* - * allocate a hash table for PROCLOCK structs. This is used to store + * allocate a hash table for HOLDER structs. This is used to store * per-lock-holder information. */ - info.keysize = SHMEM_PROCLOCKTAB_KEYSIZE; - info.datasize = SHMEM_PROCLOCKTAB_DATASIZE; + info.keysize = SHMEM_HOLDERTAB_KEYSIZE; + info.datasize = SHMEM_HOLDERTAB_DATASIZE; info.hash = tag_hash; hash_flags = (HASH_ELEM | HASH_FUNCTION); @@ -449,8 +449,8 @@ bool LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag, TransactionId xid, LOCKMODE lockmode, bool dontWait) { - PROCLOCK *holder; - PROCLOCKTAG holdertag; + HOLDER *holder; + HOLDERTAG holdertag; HTAB *holderTable; bool found; LOCK *lock; @@ -520,7 +520,7 @@ LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag, /* * Create the hash key for the holder table. */ - MemSet(&holdertag, 0, sizeof(PROCLOCKTAG)); /* must clear padding, + MemSet(&holdertag, 0, sizeof(HOLDERTAG)); /* must clear padding, * needed */ holdertag.lock = MAKE_OFFSET(lock); holdertag.proc = MAKE_OFFSET(MyProc); @@ -530,7 +530,7 @@ LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag, * Find or create a holder entry with this tag */ holderTable = lockMethodTable->holderHash; - holder = (PROCLOCK *) hash_search(holderTable, (Pointer) &holdertag, + holder = (HOLDER *) hash_search(holderTable, (Pointer) &holdertag, HASH_ENTER, &found); if (!holder) { @@ -549,11 +549,11 @@ LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag, /* Add holder to appropriate lists */ SHMQueueInsertBefore(&lock->lockHolders, &holder->lockLink); SHMQueueInsertBefore(&MyProc->procHolders, &holder->procLink); - PROCLOCK_PRINT("LockAcquire: new", holder); + HOLDER_PRINT("LockAcquire: new", holder); } else { - PROCLOCK_PRINT("LockAcquire: found", holder); + HOLDER_PRINT("LockAcquire: found", holder); Assert((holder->nHolding >= 0) && (holder->holding[lockmode] >= 0)); Assert(holder->nHolding <= lock->nGranted); @@ -606,7 +606,7 @@ LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag, if (holder->holding[lockmode] > 0) { GrantLock(lock, holder, lockmode); - PROCLOCK_PRINT("LockAcquire: owning", holder); + HOLDER_PRINT("LockAcquire: owning", holder); LWLockRelease(masterLock); return TRUE; } @@ -619,7 +619,7 @@ LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag, if (myHolding[lockmode] > 0) { GrantLock(lock, holder, lockmode); - PROCLOCK_PRINT("LockAcquire: my other XID owning", holder); + HOLDER_PRINT("LockAcquire: my other XID owning", holder); LWLockRelease(masterLock); return TRUE; } @@ -654,14 +654,14 @@ LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag, { SHMQueueDelete(&holder->lockLink); SHMQueueDelete(&holder->procLink); - holder = (PROCLOCK *) hash_search(holderTable, + holder = (HOLDER *) hash_search(holderTable, (Pointer) holder, HASH_REMOVE, &found); if (!holder || !found) elog(NOTICE, "LockAcquire: remove holder, table corrupted"); } else - PROCLOCK_PRINT("LockAcquire: NHOLDING", holder); + HOLDER_PRINT("LockAcquire: NHOLDING", holder); lock->nRequested--; lock->requested[lockmode]--; LOCK_PRINT("LockAcquire: conditional lock failed", lock, lockmode); @@ -706,13 +706,13 @@ LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag, */ if (!((holder->nHolding > 0) && (holder->holding[lockmode] > 0))) { - PROCLOCK_PRINT("LockAcquire: INCONSISTENT", holder); + HOLDER_PRINT("LockAcquire: INCONSISTENT", holder); LOCK_PRINT("LockAcquire: INCONSISTENT", lock, lockmode); /* Should we retry ? */ LWLockRelease(masterLock); return FALSE; } - PROCLOCK_PRINT("LockAcquire: granted", holder); + HOLDER_PRINT("LockAcquire: granted", holder); LOCK_PRINT("LockAcquire: granted", lock, lockmode); } @@ -741,7 +741,7 @@ int LockCheckConflicts(LOCKMETHODTABLE *lockMethodTable, LOCKMODE lockmode, LOCK *lock, - PROCLOCK *holder, + HOLDER *holder, PROC *proc, int *myHolding) /* myHolding[] array or NULL */ { @@ -763,7 +763,7 @@ LockCheckConflicts(LOCKMETHODTABLE *lockMethodTable, */ if (!(lockctl->conflictTab[lockmode] & lock->grantMask)) { - PROCLOCK_PRINT("LockCheckConflicts: no conflict", holder); + HOLDER_PRINT("LockCheckConflicts: no conflict", holder); return STATUS_OK; } @@ -797,11 +797,11 @@ LockCheckConflicts(LOCKMETHODTABLE *lockMethodTable, if (!(lockctl->conflictTab[lockmode] & bitmask)) { /* no conflict. OK to get the lock */ - PROCLOCK_PRINT("LockCheckConflicts: resolved", holder); + HOLDER_PRINT("LockCheckConflicts: resolved", holder); return STATUS_OK; } - PROCLOCK_PRINT("LockCheckConflicts: conflicting", holder); + HOLDER_PRINT("LockCheckConflicts: conflicting", holder); return STATUS_FOUND; } @@ -819,13 +819,13 @@ static void LockCountMyLocks(SHMEM_OFFSET lockOffset, PROC *proc, int *myHolding) { SHM_QUEUE *procHolders = &(proc->procHolders); - PROCLOCK *holder; + HOLDER *holder; int i; MemSet(myHolding, 0, MAX_LOCKMODES * sizeof(int)); - holder = (PROCLOCK *) SHMQueueNext(procHolders, procHolders, - offsetof(PROCLOCK, procLink)); + holder = (HOLDER *) SHMQueueNext(procHolders, procHolders, + offsetof(HOLDER, procLink)); while (holder) { @@ -835,8 +835,8 @@ LockCountMyLocks(SHMEM_OFFSET lockOffset, PROC *proc, int *myHolding) myHolding[i] += holder->holding[i]; } - holder = (PROCLOCK *) SHMQueueNext(procHolders, &holder->procLink, - offsetof(PROCLOCK, procLink)); + holder = (HOLDER *) SHMQueueNext(procHolders, &holder->procLink, + offsetof(HOLDER, procLink)); } } @@ -848,7 +848,7 @@ LockCountMyLocks(SHMEM_OFFSET lockOffset, PROC *proc, int *myHolding) * and have its waitLock/waitHolder fields cleared. That's not done here. */ void -GrantLock(LOCK *lock, PROCLOCK *holder, LOCKMODE lockmode) +GrantLock(LOCK *lock, HOLDER *holder, LOCKMODE lockmode) { lock->nGranted++; lock->granted[lockmode]++; @@ -873,7 +873,7 @@ GrantLock(LOCK *lock, PROCLOCK *holder, LOCKMODE lockmode) */ static int WaitOnLock(LOCKMETHOD lockmethod, LOCKMODE lockmode, - LOCK *lock, PROCLOCK *holder) + LOCK *lock, HOLDER *holder) { LOCKMETHODTABLE *lockMethodTable = LockMethodTable[lockmethod]; char *new_status, @@ -991,8 +991,8 @@ LockRelease(LOCKMETHOD lockmethod, LOCKTAG *locktag, LWLockId masterLock; bool found; LOCKMETHODTABLE *lockMethodTable; - PROCLOCK *holder; - PROCLOCKTAG holdertag; + HOLDER *holder; + HOLDERTAG holdertag; HTAB *holderTable; bool wakeupNeeded = false; @@ -1044,14 +1044,14 @@ LockRelease(LOCKMETHOD lockmethod, LOCKTAG *locktag, /* * Find the holder entry for this holder. */ - MemSet(&holdertag, 0, sizeof(PROCLOCKTAG)); /* must clear padding, + MemSet(&holdertag, 0, sizeof(HOLDERTAG)); /* must clear padding, * needed */ holdertag.lock = MAKE_OFFSET(lock); holdertag.proc = MAKE_OFFSET(MyProc); TransactionIdStore(xid, &holdertag.xid); holderTable = lockMethodTable->holderHash; - holder = (PROCLOCK *) hash_search(holderTable, (Pointer) &holdertag, + holder = (HOLDER *) hash_search(holderTable, (Pointer) &holdertag, HASH_FIND_SAVE, &found); if (!holder || !found) { @@ -1064,7 +1064,7 @@ LockRelease(LOCKMETHOD lockmethod, LOCKTAG *locktag, elog(NOTICE, "LockRelease: holder table corrupted"); return FALSE; } - PROCLOCK_PRINT("LockRelease: found", holder); + HOLDER_PRINT("LockRelease: found", holder); /* * Check that we are actually holding a lock of the type we want to @@ -1072,7 +1072,7 @@ LockRelease(LOCKMETHOD lockmethod, LOCKTAG *locktag, */ if (!(holder->holding[lockmode] > 0)) { - PROCLOCK_PRINT("LockRelease: WRONGTYPE", holder); + HOLDER_PRINT("LockRelease: WRONGTYPE", holder); Assert(holder->holding[lockmode] >= 0); LWLockRelease(masterLock); elog(NOTICE, "LockRelease: you don't own a lock of type %s", @@ -1141,7 +1141,7 @@ LockRelease(LOCKMETHOD lockmethod, LOCKTAG *locktag, */ holder->holding[lockmode]--; holder->nHolding--; - PROCLOCK_PRINT("LockRelease: updated", holder); + HOLDER_PRINT("LockRelease: updated", holder); Assert((holder->nHolding >= 0) && (holder->holding[lockmode] >= 0)); /* @@ -1150,10 +1150,10 @@ LockRelease(LOCKMETHOD lockmethod, LOCKTAG *locktag, */ if (holder->nHolding == 0) { - PROCLOCK_PRINT("LockRelease: deleting", holder); + HOLDER_PRINT("LockRelease: deleting", holder); SHMQueueDelete(&holder->lockLink); SHMQueueDelete(&holder->procLink); - holder = (PROCLOCK *) hash_search(holderTable, (Pointer) &holder, + holder = (HOLDER *) hash_search(holderTable, (Pointer) &holder, HASH_REMOVE_SAVED, &found); if (!holder || !found) { @@ -1189,8 +1189,8 @@ LockReleaseAll(LOCKMETHOD lockmethod, PROC *proc, bool allxids, TransactionId xid) { SHM_QUEUE *procHolders = &(proc->procHolders); - PROCLOCK *holder; - PROCLOCK *nextHolder; + HOLDER *holder; + HOLDER *nextHolder; LWLockId masterLock; LOCKMETHODTABLE *lockMethodTable; int i, @@ -1217,16 +1217,16 @@ LockReleaseAll(LOCKMETHOD lockmethod, PROC *proc, LWLockAcquire(masterLock, LW_EXCLUSIVE); - holder = (PROCLOCK *) SHMQueueNext(procHolders, procHolders, - offsetof(PROCLOCK, procLink)); + holder = (HOLDER *) SHMQueueNext(procHolders, procHolders, + offsetof(HOLDER, procLink)); while (holder) { bool wakeupNeeded = false; /* Get link first, since we may unlink/delete this holder */ - nextHolder = (PROCLOCK *) SHMQueueNext(procHolders, &holder->procLink, - offsetof(PROCLOCK, procLink)); + nextHolder = (HOLDER *) SHMQueueNext(procHolders, &holder->procLink, + offsetof(HOLDER, procLink)); Assert(holder->tag.proc == MAKE_OFFSET(proc)); @@ -1240,7 +1240,7 @@ LockReleaseAll(LOCKMETHOD lockmethod, PROC *proc, if (!allxids && !TransactionIdEquals(xid, holder->tag.xid)) goto next_item; - PROCLOCK_PRINT("LockReleaseAll", holder); + HOLDER_PRINT("LockReleaseAll", holder); LOCK_PRINT("LockReleaseAll", lock, 0); Assert(lock->nRequested >= 0); Assert(lock->nGranted >= 0); @@ -1294,7 +1294,7 @@ LockReleaseAll(LOCKMETHOD lockmethod, PROC *proc, } LOCK_PRINT("LockReleaseAll: updated", lock, 0); - PROCLOCK_PRINT("LockReleaseAll: deleting", holder); + HOLDER_PRINT("LockReleaseAll: deleting", holder); /* * Remove the holder entry from the linked lists @@ -1305,7 +1305,7 @@ LockReleaseAll(LOCKMETHOD lockmethod, PROC *proc, /* * remove the holder entry from the hashtable */ - holder = (PROCLOCK *) hash_search(lockMethodTable->holderHash, + holder = (HOLDER *) hash_search(lockMethodTable->holderHash, (Pointer) holder, HASH_REMOVE, &found); @@ -1370,8 +1370,8 @@ LockShmemSize(int maxBackends) /* holderHash table */ size += hash_estimate_size(max_table_size, - SHMEM_PROCLOCKTAB_KEYSIZE, - SHMEM_PROCLOCKTAB_DATASIZE); + SHMEM_HOLDERTAB_KEYSIZE, + SHMEM_HOLDERTAB_DATASIZE); /* * Since the lockHash entry count above is only an estimate, add 10% @@ -1394,7 +1394,7 @@ DumpLocks(void) { PROC *proc; SHM_QUEUE *procHolders; - PROCLOCK *holder; + HOLDER *holder; LOCK *lock; int lockmethod = DEFAULT_LOCKMETHOD; LOCKMETHODTABLE *lockMethodTable; @@ -1413,8 +1413,8 @@ DumpLocks(void) if (proc->waitLock) LOCK_PRINT("DumpLocks: waiting on", proc->waitLock, 0); - holder = (PROCLOCK *) SHMQueueNext(procHolders, procHolders, - offsetof(PROCLOCK, procLink)); + holder = (HOLDER *) SHMQueueNext(procHolders, procHolders, + offsetof(HOLDER, procLink)); while (holder) { @@ -1422,11 +1422,11 @@ DumpLocks(void) lock = (LOCK *) MAKE_PTR(holder->tag.lock); - PROCLOCK_PRINT("DumpLocks", holder); + HOLDER_PRINT("DumpLocks", holder); LOCK_PRINT("DumpLocks", lock, 0); - holder = (PROCLOCK *) SHMQueueNext(procHolders, &holder->procLink, - offsetof(PROCLOCK, procLink)); + holder = (HOLDER *) SHMQueueNext(procHolders, &holder->procLink, + offsetof(HOLDER, procLink)); } } @@ -1437,7 +1437,7 @@ void DumpAllLocks(void) { PROC *proc; - PROCLOCK *holder = NULL; + HOLDER *holder = NULL; LOCK *lock; int lockmethod = DEFAULT_LOCKMETHOD; LOCKMETHODTABLE *lockMethodTable; @@ -1459,10 +1459,10 @@ DumpAllLocks(void) LOCK_PRINT("DumpAllLocks: waiting on", proc->waitLock, 0); hash_seq_init(&status, holderTable); - while ((holder = (PROCLOCK *) hash_seq_search(&status)) && - (holder != (PROCLOCK *) TRUE)) + while ((holder = (HOLDER *) hash_seq_search(&status)) && + (holder != (HOLDER *) TRUE)) { - PROCLOCK_PRINT("DumpAllLocks", holder); + HOLDER_PRINT("DumpAllLocks", holder); if (holder->tag.lock) { diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c index 270be867b8a2b7f85a54c203ad722749e1d42a3b..a8f1b7bfbc6ae77bc7fdb55c6360abf6c16cefc3 100644 --- a/src/backend/storage/lmgr/proc.c +++ b/src/backend/storage/lmgr/proc.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.110 2001/09/29 21:35:14 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.111 2001/09/30 00:45:47 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -563,7 +563,7 @@ int ProcSleep(LOCKMETHODTABLE *lockMethodTable, LOCKMODE lockmode, LOCK *lock, - PROCLOCK *holder) + HOLDER *holder) { LOCKMETHODCTL *lockctl = lockMethodTable->ctl; LWLockId masterLock = lockctl->masterLock; diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h index 28ef733e9b0fb34304de32a4575fcdb554266bf5..f61f085e191631a739a1e62f62037a6993842b68 100644 --- a/src/include/storage/lock.h +++ b/src/include/storage/lock.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: lock.h,v 1.54 2001/09/29 21:35:14 momjian Exp $ + * $Id: lock.h,v 1.55 2001/09/30 00:45:48 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -144,7 +144,7 @@ typedef struct LOCKTAG * tag -- uniquely identifies the object being locked * grantMask -- bitmask for all lock types currently granted on this object. * waitMask -- bitmask for all lock types currently awaited on this object. - * lockHolders -- list of PROCLOCK objects for this lock. + * lockHolders -- list of HOLDER objects for this lock. * waitProcs -- queue of processes waiting for this lock. * requested -- count of each lock type currently requested on the lock * (includes requests already granted!!). @@ -160,7 +160,7 @@ typedef struct LOCK /* data */ int grantMask; /* bitmask for lock types already granted */ int waitMask; /* bitmask for lock types awaited */ - SHM_QUEUE lockHolders; /* list of PROCLOCK objects assoc. with lock */ + SHM_QUEUE lockHolders; /* list of HOLDER objects assoc. with lock */ PROC_QUEUE waitProcs; /* list of PROC objects waiting on lock */ int requested[MAX_LOCKMODES]; /* counts of requested * locks */ @@ -180,8 +180,8 @@ typedef struct LOCK * on the same lockable object. We need to store some per-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. + * HOLDERTAG is the key information needed to look up a HOLDER item in the + * holder hashtable. A HOLDERTAG value uniquely identifies a lock holder. * * There are two possible kinds of holder tags: a transaction (identified * both by the PROC of the backend running it, and the xact's own ID) and @@ -197,35 +197,35 @@ typedef struct LOCK * Otherwise, holder 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 - * and the owning PROC object. Note that the PROCLOCK is entered into these + * Each HOLDER object is linked into lists for both the associated LOCK object + * and the owning PROC object. Note that the HOLDER is entered into these * lists as soon as it is created, even if no lock has yet been granted. * A PROC that is waiting for a lock to be granted will also be linked into * the lock's waitProcs queue. */ -typedef struct PROCLOCKTAG +typedef struct HOLDERTAG { SHMEM_OFFSET lock; /* link to per-lockable-object information */ SHMEM_OFFSET proc; /* link to PROC of owning backend */ TransactionId xid; /* xact ID, or InvalidTransactionId */ -} PROCLOCKTAG; +} HOLDERTAG; -typedef struct PROCLOCK +typedef struct HOLDER { /* tag */ - PROCLOCKTAG tag; /* unique identifier of holder object */ + HOLDERTAG tag; /* unique identifier of holder 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 */ -} PROCLOCK; +} HOLDER; -#define SHMEM_PROCLOCKTAB_KEYSIZE sizeof(PROCLOCKTAG) -#define SHMEM_PROCLOCKTAB_DATASIZE (sizeof(PROCLOCK) - SHMEM_PROCLOCKTAB_KEYSIZE) +#define SHMEM_HOLDERTAB_KEYSIZE sizeof(HOLDERTAG) +#define SHMEM_HOLDERTAB_DATASIZE (sizeof(HOLDER) - SHMEM_HOLDERTAB_KEYSIZE) -#define PROCLOCK_LOCKMETHOD(holder) \ +#define HOLDER_LOCKMETHOD(holder) \ (((LOCK *) MAKE_PTR((holder).tag.lock))->tag.lockmethod) @@ -245,9 +245,9 @@ extern bool LockReleaseAll(LOCKMETHOD lockmethod, PROC *proc, bool allxids, TransactionId xid); extern int LockCheckConflicts(LOCKMETHODTABLE *lockMethodTable, LOCKMODE lockmode, - LOCK *lock, PROCLOCK *holder, PROC *proc, + LOCK *lock, HOLDER *holder, PROC *proc, int *myHolding); -extern void GrantLock(LOCK *lock, PROCLOCK *holder, LOCKMODE lockmode); +extern void GrantLock(LOCK *lock, HOLDER *holder, LOCKMODE lockmode); extern void RemoveFromWaitQueue(PROC *proc); extern int LockShmemSize(int maxBackends); extern bool DeadLockCheck(PROC *proc); diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index 94849646b7472710c54a6b5bf63c4461c83c49f1..fe5f255badb9220c1c4136566dc0819cd2600b6e 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: proc.h,v 1.49 2001/09/29 21:35:14 momjian Exp $ + * $Id: proc.h,v 1.50 2001/09/30 00:45:48 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -67,12 +67,12 @@ struct PROC /* Info about lock the process is currently waiting for, if any. */ /* waitLock and waitHolder are NULL if not currently waiting. */ LOCK *waitLock; /* Lock object we're sleeping on ... */ - PROCLOCK *waitHolder; /* Per-holder info for awaited lock */ + HOLDER *waitHolder; /* Per-holder info for awaited lock */ LOCKMODE waitLockMode; /* type of lock we're waiting for */ LOCKMASK heldLocks; /* bitmask for lock types already held on * this lock object by this backend */ - SHM_QUEUE procHolders; /* list of PROCLOCK objects for locks held + SHM_QUEUE procHolders; /* list of HOLDER objects for locks held * or awaited by this backend */ }; @@ -138,7 +138,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, HOLDER *holder); extern PROC *ProcWakeup(PROC *proc, int errType); extern void ProcLockWakeup(LOCKMETHODTABLE *lockMethodTable, LOCK *lock); extern bool LockWaitCancel(void);