OSDN Git Service

Do this TODO item:
authorBruce Momjian <bruce@momjian.us>
Sat, 29 Sep 2001 21:35:14 +0000 (21:35 +0000)
committerBruce Momjian <bruce@momjian.us>
Sat, 29 Sep 2001 21:35:14 +0000 (21:35 +0000)
* HOLDER/HOLDERTAB rename to PROCLOCK/PROCLOCKTAG (Tom)

Didn't use PROCLOCKLINK because it made PROCLOCKLINKTAG too long.

src/backend/storage/lmgr/deadlock.c
src/backend/storage/lmgr/lock.c
src/backend/storage/lmgr/proc.c
src/include/storage/lock.h
src/include/storage/proc.h

index a69a078..78386fe 100644 (file)
@@ -12,7 +12,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/storage/lmgr/deadlock.c,v 1.4 2001/09/29 04:02:24 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/storage/lmgr/deadlock.c,v 1.5 2001/09/29 21:35:14 momjian Exp $
  *
  *     Interface:
  *
@@ -382,7 +382,7 @@ FindLockCycleRecurse(PROC *checkProc,
 {
        PROC       *proc;
        LOCK       *lock;
-       HOLDER     *holder;
+       PROCLOCK           *holder;
        SHM_QUEUE  *lockHolders;
        LOCKMETHODTABLE *lockMethodTable;
        LOCKMETHODCTL *lockctl;
@@ -434,8 +434,8 @@ FindLockCycleRecurse(PROC *checkProc,
         */
        lockHolders = &(lock->lockHolders);
 
-       holder = (HOLDER *) SHMQueueNext(lockHolders, lockHolders,
-                                                                        offsetof(HOLDER, lockLink));
+       holder = (PROCLOCK *) SHMQueueNext(lockHolders, lockHolders,
+                                                                        offsetof(PROCLOCK, lockLink));
 
        while (holder)
        {
@@ -458,8 +458,8 @@ FindLockCycleRecurse(PROC *checkProc,
                        }
                }
 
-               holder = (HOLDER *) SHMQueueNext(lockHolders, &holder->lockLink,
-                                                                                offsetof(HOLDER, lockLink));
+               holder = (PROCLOCK *) SHMQueueNext(lockHolders, &holder->lockLink,
+                                                                                offsetof(PROCLOCK, lockLink));
        }
 
        /*
index b3221db..ba84f52 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.96 2001/09/29 04:02:24 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.97 2001/09/29 21:35:14 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, HOLDER *holder);
+                  LOCK *lock, PROCLOCK *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
-HOLDER_PRINT(const char *where, const HOLDER *holderP)
+PROCLOCK_PRINT(const char *where, const PROCLOCK *holderP)
 {
        if (
-        (((HOLDER_LOCKMETHOD(*holderP) == DEFAULT_LOCKMETHOD && Trace_locks)
-          || (HOLDER_LOCKMETHOD(*holderP) == USER_LOCKMETHOD && Trace_userlocks))
+        (((PROCLOCK_LOCKMETHOD(*holderP) == DEFAULT_LOCKMETHOD && Trace_locks)
+          || (PROCLOCK_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,
-                        HOLDER_LOCKMETHOD(*(holderP)),
+                        PROCLOCK_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 @@ HOLDER_PRINT(const char *where, const HOLDER *holderP)
 #else                                                  /* not LOCK_DEBUG */
 
 #define LOCK_PRINT(where, lock, type)
-#define HOLDER_PRINT(where, holderP)
+#define PROCLOCK_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 HOLDER structs.  This is used to store
+        * allocate a hash table for PROCLOCK structs.  This is used to store
         * per-lock-holder information.
         */
-       info.keysize = SHMEM_HOLDERTAB_KEYSIZE;
-       info.datasize = SHMEM_HOLDERTAB_DATASIZE;
+       info.keysize = SHMEM_PROCLOCKTAB_KEYSIZE;
+       info.datasize = SHMEM_PROCLOCKTAB_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)
 {
-       HOLDER     *holder;
-       HOLDERTAG       holdertag;
+       PROCLOCK           *holder;
+       PROCLOCKTAG     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(HOLDERTAG));       /* must clear padding,
+       MemSet(&holdertag, 0, sizeof(PROCLOCKTAG));     /* 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 = (HOLDER *) hash_search(holderTable, (Pointer) &holdertag,
+       holder = (PROCLOCK *) 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);
-               HOLDER_PRINT("LockAcquire: new", holder);
+               PROCLOCK_PRINT("LockAcquire: new", holder);
        }
        else
        {
-               HOLDER_PRINT("LockAcquire: found", holder);
+               PROCLOCK_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);
-               HOLDER_PRINT("LockAcquire: owning", holder);
+               PROCLOCK_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);
-               HOLDER_PRINT("LockAcquire: my other XID owning", holder);
+               PROCLOCK_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 = (HOLDER *) hash_search(holderTable,
+                               holder = (PROCLOCK *) hash_search(holderTable,
                                                                                                (Pointer) holder,
                                                                                                HASH_REMOVE, &found);
                                if (!holder || !found)
                                        elog(NOTICE, "LockAcquire: remove holder, table corrupted");
                        }
                        else
-                               HOLDER_PRINT("LockAcquire: NHOLDING", holder);
+                               PROCLOCK_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)))
                {
-                       HOLDER_PRINT("LockAcquire: INCONSISTENT", holder);
+                       PROCLOCK_PRINT("LockAcquire: INCONSISTENT", holder);
                        LOCK_PRINT("LockAcquire: INCONSISTENT", lock, lockmode);
                        /* Should we retry ? */
                        LWLockRelease(masterLock);
                        return FALSE;
                }
-               HOLDER_PRINT("LockAcquire: granted", holder);
+               PROCLOCK_PRINT("LockAcquire: granted", holder);
                LOCK_PRINT("LockAcquire: granted", lock, lockmode);
        }
 
@@ -741,7 +741,7 @@ int
 LockCheckConflicts(LOCKMETHODTABLE *lockMethodTable,
                                   LOCKMODE lockmode,
                                   LOCK *lock,
-                                  HOLDER *holder,
+                                  PROCLOCK *holder,
                                   PROC *proc,
                                   int *myHolding)              /* myHolding[] array or NULL */
 {
@@ -763,7 +763,7 @@ LockCheckConflicts(LOCKMETHODTABLE *lockMethodTable,
         */
        if (!(lockctl->conflictTab[lockmode] & lock->grantMask))
        {
-               HOLDER_PRINT("LockCheckConflicts: no conflict", holder);
+               PROCLOCK_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 */
-               HOLDER_PRINT("LockCheckConflicts: resolved", holder);
+               PROCLOCK_PRINT("LockCheckConflicts: resolved", holder);
                return STATUS_OK;
        }
 
-       HOLDER_PRINT("LockCheckConflicts: conflicting", holder);
+       PROCLOCK_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);
-       HOLDER     *holder;
+       PROCLOCK           *holder;
        int                     i;
 
        MemSet(myHolding, 0, MAX_LOCKMODES * sizeof(int));
 
-       holder = (HOLDER *) SHMQueueNext(procHolders, procHolders,
-                                                                        offsetof(HOLDER, procLink));
+       holder = (PROCLOCK *) SHMQueueNext(procHolders, procHolders,
+                                                                        offsetof(PROCLOCK, procLink));
 
        while (holder)
        {
@@ -835,8 +835,8 @@ LockCountMyLocks(SHMEM_OFFSET lockOffset, PROC *proc, int *myHolding)
                                myHolding[i] += holder->holding[i];
                }
 
-               holder = (HOLDER *) SHMQueueNext(procHolders, &holder->procLink,
-                                                                                offsetof(HOLDER, procLink));
+               holder = (PROCLOCK *) SHMQueueNext(procHolders, &holder->procLink,
+                                                                                offsetof(PROCLOCK, 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, HOLDER *holder, LOCKMODE lockmode)
+GrantLock(LOCK *lock, PROCLOCK *holder, LOCKMODE lockmode)
 {
        lock->nGranted++;
        lock->granted[lockmode]++;
@@ -873,7 +873,7 @@ GrantLock(LOCK *lock, HOLDER *holder, LOCKMODE lockmode)
  */
 static int
 WaitOnLock(LOCKMETHOD lockmethod, LOCKMODE lockmode,
-                  LOCK *lock, HOLDER *holder)
+                  LOCK *lock, PROCLOCK *holder)
 {
        LOCKMETHODTABLE *lockMethodTable = LockMethodTable[lockmethod];
        char       *new_status,
@@ -991,8 +991,8 @@ LockRelease(LOCKMETHOD lockmethod, LOCKTAG *locktag,
        LWLockId        masterLock;
        bool            found;
        LOCKMETHODTABLE *lockMethodTable;
-       HOLDER     *holder;
-       HOLDERTAG       holdertag;
+       PROCLOCK           *holder;
+       PROCLOCKTAG     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(HOLDERTAG));       /* must clear padding,
+       MemSet(&holdertag, 0, sizeof(PROCLOCKTAG));     /* must clear padding,
                                                                                                 * needed */
        holdertag.lock = MAKE_OFFSET(lock);
        holdertag.proc = MAKE_OFFSET(MyProc);
        TransactionIdStore(xid, &holdertag.xid);
 
        holderTable = lockMethodTable->holderHash;
-       holder = (HOLDER *) hash_search(holderTable, (Pointer) &holdertag,
+       holder = (PROCLOCK *) 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;
        }
-       HOLDER_PRINT("LockRelease: found", holder);
+       PROCLOCK_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))
        {
-               HOLDER_PRINT("LockRelease: WRONGTYPE", holder);
+               PROCLOCK_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--;
-       HOLDER_PRINT("LockRelease: updated", holder);
+       PROCLOCK_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)
        {
-               HOLDER_PRINT("LockRelease: deleting", holder);
+               PROCLOCK_PRINT("LockRelease: deleting", holder);
                SHMQueueDelete(&holder->lockLink);
                SHMQueueDelete(&holder->procLink);
-               holder = (HOLDER *) hash_search(holderTable, (Pointer) &holder,
+               holder = (PROCLOCK *) 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);
-       HOLDER     *holder;
-       HOLDER     *nextHolder;
+       PROCLOCK           *holder;
+       PROCLOCK           *nextHolder;
        LWLockId        masterLock;
        LOCKMETHODTABLE *lockMethodTable;
        int                     i,
@@ -1217,16 +1217,16 @@ LockReleaseAll(LOCKMETHOD lockmethod, PROC *proc,
 
        LWLockAcquire(masterLock, LW_EXCLUSIVE);
 
-       holder = (HOLDER *) SHMQueueNext(procHolders, procHolders,
-                                                                        offsetof(HOLDER, procLink));
+       holder = (PROCLOCK *) SHMQueueNext(procHolders, procHolders,
+                                                                        offsetof(PROCLOCK, procLink));
 
        while (holder)
        {
                bool            wakeupNeeded = false;
 
                /* Get link first, since we may unlink/delete this holder */
-               nextHolder = (HOLDER *) SHMQueueNext(procHolders, &holder->procLink,
-                                                                                        offsetof(HOLDER, procLink));
+               nextHolder = (PROCLOCK *) SHMQueueNext(procHolders, &holder->procLink,
+                                                                                        offsetof(PROCLOCK, 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;
 
-               HOLDER_PRINT("LockReleaseAll", holder);
+               PROCLOCK_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);
 
-               HOLDER_PRINT("LockReleaseAll: deleting", holder);
+               PROCLOCK_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 = (HOLDER *) hash_search(lockMethodTable->holderHash,
+               holder = (PROCLOCK *) 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_HOLDERTAB_KEYSIZE,
-                                                          SHMEM_HOLDERTAB_DATASIZE);
+                                                          SHMEM_PROCLOCKTAB_KEYSIZE,
+                                                          SHMEM_PROCLOCKTAB_DATASIZE);
 
        /*
         * Since the lockHash entry count above is only an estimate, add 10%
@@ -1394,7 +1394,7 @@ DumpLocks(void)
 {
        PROC       *proc;
        SHM_QUEUE  *procHolders;
-       HOLDER     *holder;
+       PROCLOCK           *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 = (HOLDER *) SHMQueueNext(procHolders, procHolders,
-                                                                        offsetof(HOLDER, procLink));
+       holder = (PROCLOCK *) SHMQueueNext(procHolders, procHolders,
+                                                                        offsetof(PROCLOCK, procLink));
 
        while (holder)
        {
@@ -1422,11 +1422,11 @@ DumpLocks(void)
 
                lock = (LOCK *) MAKE_PTR(holder->tag.lock);
 
-               HOLDER_PRINT("DumpLocks", holder);
+               PROCLOCK_PRINT("DumpLocks", holder);
                LOCK_PRINT("DumpLocks", lock, 0);
 
-               holder = (HOLDER *) SHMQueueNext(procHolders, &holder->procLink,
-                                                                                offsetof(HOLDER, procLink));
+               holder = (PROCLOCK *) SHMQueueNext(procHolders, &holder->procLink,
+                                                                                offsetof(PROCLOCK, procLink));
        }
 }
 
@@ -1437,7 +1437,7 @@ void
 DumpAllLocks(void)
 {
        PROC       *proc;
-       HOLDER     *holder = NULL;
+       PROCLOCK           *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 = (HOLDER *) hash_seq_search(&status)) &&
-                  (holder != (HOLDER *) TRUE))
+       while ((holder = (PROCLOCK *) hash_seq_search(&status)) &&
+                  (holder != (PROCLOCK *) TRUE))
        {
-               HOLDER_PRINT("DumpAllLocks", holder);
+               PROCLOCK_PRINT("DumpAllLocks", holder);
 
                if (holder->tag.lock)
                {
index e687304..270be86 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.109 2001/09/29 04:02:24 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.110 2001/09/29 21:35:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -563,7 +563,7 @@ int
 ProcSleep(LOCKMETHODTABLE *lockMethodTable,
                  LOCKMODE lockmode,
                  LOCK *lock,
-                 HOLDER *holder)
+                 PROCLOCK *holder)
 {
        LOCKMETHODCTL *lockctl = lockMethodTable->ctl;
        LWLockId        masterLock = lockctl->masterLock;
index b5ac03e..28ef733 100644 (file)
@@ -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.53 2001/09/29 04:02:26 tgl Exp $
+ * $Id: lock.h,v 1.54 2001/09/29 21:35:14 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 HOLDER objects for this lock.
+ * lockHolders -- list of PROCLOCK 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 HOLDER objects assoc. with lock */
+       SHM_QUEUE       lockHolders;    /* list of PROCLOCK 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).
  *
- * HOLDERTAG is the key information needed to look up a HOLDER item in the
- * holder hashtable.  A HOLDERTAG value uniquely identifies a lock 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.
  *
  * 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 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
+ * 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
  * 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 HOLDERTAG
+typedef struct PROCLOCKTAG
 {
        SHMEM_OFFSET lock;                      /* link to per-lockable-object information */
        SHMEM_OFFSET proc;                      /* link to PROC of owning backend */
        TransactionId xid;                      /* xact ID, or InvalidTransactionId */
-} HOLDERTAG;
+} PROCLOCKTAG;
 
-typedef struct HOLDER
+typedef struct PROCLOCK
 {
        /* tag */
-       HOLDERTAG       tag;                    /* unique identifier of holder object */
+       PROCLOCKTAG     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 */
-} HOLDER;
+} PROCLOCK;
 
-#define SHMEM_HOLDERTAB_KEYSIZE  sizeof(HOLDERTAG)
-#define SHMEM_HOLDERTAB_DATASIZE (sizeof(HOLDER) - SHMEM_HOLDERTAB_KEYSIZE)
+#define SHMEM_PROCLOCKTAB_KEYSIZE  sizeof(PROCLOCKTAG)
+#define SHMEM_PROCLOCKTAB_DATASIZE (sizeof(PROCLOCK) - SHMEM_PROCLOCKTAB_KEYSIZE)
 
-#define HOLDER_LOCKMETHOD(holder) \
+#define PROCLOCK_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, HOLDER *holder, PROC *proc,
+                                  LOCK *lock, PROCLOCK *holder, PROC *proc,
                                   int *myHolding);
-extern void GrantLock(LOCK *lock, HOLDER *holder, LOCKMODE lockmode);
+extern void GrantLock(LOCK *lock, PROCLOCK *holder, LOCKMODE lockmode);
 extern void RemoveFromWaitQueue(PROC *proc);
 extern int     LockShmemSize(int maxBackends);
 extern bool DeadLockCheck(PROC *proc);
index 77def9f..9484964 100644 (file)
@@ -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.48 2001/09/29 04:02:26 tgl Exp $
+ * $Id: proc.h,v 1.49 2001/09/29 21:35:14 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 ... */
-       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 */
        LOCKMASK        heldLocks;              /* bitmask for lock types already held on
                                                                 * 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 */
 };
 
@@ -138,7 +138,7 @@ extern void ProcReleaseLocks(bool isCommit);
 
 extern void ProcQueueInit(PROC_QUEUE *queue);
 extern int ProcSleep(LOCKMETHODTABLE *lockMethodTable, LOCKMODE lockmode,
-                 LOCK *lock, HOLDER *holder);
+                 LOCK *lock, PROCLOCK *holder);
 extern PROC *ProcWakeup(PROC *proc, int errType);
 extern void ProcLockWakeup(LOCKMETHODTABLE *lockMethodTable, LOCK *lock);
 extern bool LockWaitCancel(void);