Commit e794dfa5 authored by Tom Lane's avatar Tom Lane

Use an always-there test, not an Assert, to check for overrun of

the held_lwlocks[] array.  Per Qingqing Zhou.
parent eb4b7a0b
......@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/lmgr/lwlock.c,v 1.25 2004/12/31 22:01:05 pgsql Exp $
* $PostgreSQL: pgsql/src/backend/storage/lmgr/lwlock.c,v 1.26 2005/04/08 03:43:54 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -328,7 +328,8 @@ LWLockAcquire(LWLockId lockid, LWLockMode mode)
SpinLockRelease_NoHoldoff(&lock->mutex);
/* Add lock to list of locks held by this backend */
Assert(num_held_lwlocks < MAX_SIMUL_LWLOCKS);
if (num_held_lwlocks >= MAX_SIMUL_LWLOCKS)
elog(ERROR, "too many LWLocks taken");
held_lwlocks[num_held_lwlocks++] = lockid;
/*
......@@ -397,7 +398,8 @@ LWLockConditionalAcquire(LWLockId lockid, LWLockMode mode)
else
{
/* Add lock to list of locks held by this backend */
Assert(num_held_lwlocks < MAX_SIMUL_LWLOCKS);
if (num_held_lwlocks >= MAX_SIMUL_LWLOCKS)
elog(ERROR, "too many LWLocks taken");
held_lwlocks[num_held_lwlocks++] = lockid;
}
......
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