Remove LockMethodTable.prio - Mailing list pgsql-hackers

From Bruce Momjian
Subject Remove LockMethodTable.prio
Date
Msg-id 200207310312.g6V3CpD23602@candle.pha.pa.us
Whole thread Raw
List pgsql-hackers
I have completed this TODO item:

    * Remove LockMethodTable.prio field, not used (Bruce)

Applied.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
Index: src/backend/storage/lmgr/lmgr.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v
retrieving revision 1.53
diff -c -r1.53 lmgr.c
*** src/backend/storage/lmgr/lmgr.c    20 Jun 2002 20:29:35 -0000    1.53
--- src/backend/storage/lmgr/lmgr.c    21 Jul 2002 04:48:47 -0000
***************
*** 65,95 ****

  };

- static int    LockPrios[] = {
-     0,
-     /* AccessShareLock */
-     1,
-     /* RowShareLock */
-     2,
-     /* RowExclusiveLock */
-     3,
-     /* ShareUpdateExclusiveLock */
-     4,
-     /* ShareLock */
-     5,
-     /* ShareRowExclusiveLock */
-     6,
-     /* ExclusiveLock */
-     7,
-     /* AccessExclusiveLock */
-     8
- };
-
  LOCKMETHOD    LockTableId = (LOCKMETHOD) NULL;
  LOCKMETHOD    LongTermTableId = (LOCKMETHOD) NULL;

  /*
!  * Create the lock table described by LockConflicts and LockPrios.
   */
  LOCKMETHOD
  InitLockTable(int maxBackends)
--- 65,75 ----

  };

  LOCKMETHOD    LockTableId = (LOCKMETHOD) NULL;
  LOCKMETHOD    LongTermTableId = (LOCKMETHOD) NULL;

  /*
!  * Create the lock table described by LockConflicts
   */
  LOCKMETHOD
  InitLockTable(int maxBackends)
***************
*** 97,104 ****
      int            lockmethod;

      lockmethod = LockMethodTableInit("LockTable",
!                                      LockConflicts, LockPrios,
!                                      MAX_LOCKMODES - 1, maxBackends);
      LockTableId = lockmethod;

      if (!(LockTableId))
--- 77,84 ----
      int            lockmethod;

      lockmethod = LockMethodTableInit("LockTable",
!                                      LockConflicts, MAX_LOCKMODES - 1,
!                                      maxBackends);
      LockTableId = lockmethod;

      if (!(LockTableId))
Index: src/backend/storage/lmgr/lock.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v
retrieving revision 1.110
diff -c -r1.110 lock.c
*** src/backend/storage/lmgr/lock.c    19 Jul 2002 00:17:40 -0000    1.110
--- src/backend/storage/lmgr/lock.c    21 Jul 2002 04:48:51 -0000
***************
*** 208,225 ****
  static void
  LockMethodInit(LOCKMETHODTABLE *lockMethodTable,
                 LOCKMASK *conflictsP,
-                int *prioP,
                 int numModes)
  {
      int            i;

      lockMethodTable->numLockModes = numModes;
      numModes++;
!     for (i = 0; i < numModes; i++, prioP++, conflictsP++)
!     {
          lockMethodTable->conflictTab[i] = *conflictsP;
-         lockMethodTable->prio[i] = *prioP;
-     }
  }

  /*
--- 208,221 ----
  static void
  LockMethodInit(LOCKMETHODTABLE *lockMethodTable,
                 LOCKMASK *conflictsP,
                 int numModes)
  {
      int            i;

      lockMethodTable->numLockModes = numModes;
      numModes++;
!     for (i = 0; i < numModes; i++, conflictsP++)
          lockMethodTable->conflictTab[i] = *conflictsP;
  }

  /*
***************
*** 234,240 ****
  LOCKMETHOD
  LockMethodTableInit(char *tabName,
                      LOCKMASK *conflictsP,
-                     int *prioP,
                      int numModes,
                      int maxBackends)
  {
--- 230,235 ----
***************
*** 335,341 ****
          elog(FATAL, "LockMethodTableInit: couldn't initialize %s", tabName);

      /* init data structures */
!     LockMethodInit(lockMethodTable, conflictsP, prioP, numModes);

      LWLockRelease(LockMgrLock);

--- 330,336 ----
          elog(FATAL, "LockMethodTableInit: couldn't initialize %s", tabName);

      /* init data structures */
!     LockMethodInit(lockMethodTable, conflictsP, numModes);

      LWLockRelease(LockMgrLock);

Index: src/include/storage/lock.h
===================================================================
RCS file: /cvsroot/pgsql/src/include/storage/lock.h,v
retrieving revision 1.63
diff -c -r1.63 lock.h
*** src/include/storage/lock.h    19 Jul 2002 00:17:40 -0000    1.63
--- src/include/storage/lock.h    21 Jul 2002 04:48:52 -0000
***************
*** 80,89 ****
   *        type conflicts. conflictTab[i] is a mask with the j-th bit
   *        turned on if lock types i and j conflict.
   *
-  * prio -- each lockmode has a priority, so, for example, waiting
-  *        writers can be given priority over readers (to avoid
-  *        starvation).  XXX this field is not actually used at present!
-  *
   * masterLock -- synchronizes access to the table
   *
   */
--- 80,85 ----
***************
*** 94,100 ****
      LOCKMETHOD    lockmethod;
      int            numLockModes;
      int            conflictTab[MAX_LOCKMODES];
-     int            prio[MAX_LOCKMODES];
      LWLockId    masterLock;
  } LOCKMETHODTABLE;

--- 90,95 ----
***************
*** 215,221 ****
  extern void InitLocks(void);
  extern LOCKMETHODTABLE *GetLocksMethodTable(LOCK *lock);
  extern LOCKMETHOD LockMethodTableInit(char *tabName, LOCKMASK *conflictsP,
!                     int *prioP, int numModes, int maxBackends);
  extern LOCKMETHOD LockMethodTableRename(LOCKMETHOD lockmethod);
  extern bool LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag,
              TransactionId xid, LOCKMODE lockmode, bool dontWait);
--- 210,216 ----
  extern void InitLocks(void);
  extern LOCKMETHODTABLE *GetLocksMethodTable(LOCK *lock);
  extern LOCKMETHOD LockMethodTableInit(char *tabName, LOCKMASK *conflictsP,
!                     int numModes, int maxBackends);
  extern LOCKMETHOD LockMethodTableRename(LOCKMETHOD lockmethod);
  extern bool LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag,
              TransactionId xid, LOCKMODE lockmode, bool dontWait);

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Why is MySQL more chosen over PostgreSQL?
Next
From: Curt Sampson
Date:
Subject: Re: Why is MySQL more chosen over PostgreSQL?