Skip site navigation (1) Skip section navigation (2)

Minor fix in lwlock.c

From: "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu>
To: pgsql-patches(at)postgresql(dot)org
Subject: Minor fix in lwlock.c
Date: 2005-04-08 02:21:53
Message-ID: d34pvh$2tbh$1@news.hub.org (view raw or flat)
Thread:
Lists: pgsql-patches
The chance that num_held_lwlocks is beyond MAX_SIMUL_LWLOCKS is similar to
the chance that failed to grasp a spinlock in 1 minute, so they should be
treated in the same way. This is mainly to prevent programming error (e.g.,
forget to release the LWLocks).

Regards,
Qingqing

---

Index: lwlock.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/storage/lmgr/lwlock.c,v
retrieving revision 1.25
diff -c -r1.25 lwlock.c
*** lwlock.c    31 Dec 2004 22:01:05 -0000      1.25
--- lwlock.c    8 Apr 2005 02:19:31 -0000
***************
*** 328,334 ****
        SpinLockRelease_NoHoldoff(&lock->mutex);

        /* Add lock to list of locks held by this backend */
!       Assert(num_held_lwlocks < MAX_SIMUL_LWLOCKS);
        held_lwlocks[num_held_lwlocks++] = lockid;

        /*
--- 328,335 ----
        SpinLockRelease_NoHoldoff(&lock->mutex);

        /* Add lock to list of locks held by this backend */
!       if (num_held_lwlocks >= MAX_SIMUL_LWLOCKS)
!               elog(FATAL, "Too many LWLocks");
        held_lwlocks[num_held_lwlocks++] = lockid;

        /*
***************
*** 397,403 ****
        else
        {
                /* Add lock to list of locks held by this backend */
!               Assert(num_held_lwlocks < MAX_SIMUL_LWLOCKS);
                held_lwlocks[num_held_lwlocks++] = lockid;
        }

--- 398,405 ----
        else
        {
                /* Add lock to list of locks held by this backend */
!               if (num_held_lwlocks >= MAX_SIMUL_LWLOCKS)
!                       elog(FATAL, "Too many LWLocks");
                held_lwlocks[num_held_lwlocks++] = lockid;
        }



Responses

pgsql-patches by date

Next:From: Tom LaneDate: 2005-04-08 03:47:26
Subject: Re: Minor fix in lwlock.c
Previous:From: Neil ConwayDate: 2005-04-08 01:00:28
Subject: Re: add_missing_from = false

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group