Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite794dfa

Browse files
committed
Use an always-there test, not an Assert, to check for overrun of
the held_lwlocks[] array. Per Qingqing Zhou.
1 parenteb4b7a0 commite794dfa

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

‎src/backend/storage/lmgr/lwlock.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Portions Copyright (c) 1994, Regents of the University of California
1616
*
1717
* IDENTIFICATION
18-
* $PostgreSQL: pgsql/src/backend/storage/lmgr/lwlock.c,v 1.25 2004/12/31 22:01:05 pgsql Exp $
18+
* $PostgreSQL: pgsql/src/backend/storage/lmgr/lwlock.c,v 1.26 2005/04/08 03:43:54 tgl Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -328,7 +328,8 @@ LWLockAcquire(LWLockId lockid, LWLockMode mode)
328328
SpinLockRelease_NoHoldoff(&lock->mutex);
329329

330330
/* Add lock to list of locks held by this backend */
331-
Assert(num_held_lwlocks<MAX_SIMUL_LWLOCKS);
331+
if (num_held_lwlocks >=MAX_SIMUL_LWLOCKS)
332+
elog(ERROR,"too many LWLocks taken");
332333
held_lwlocks[num_held_lwlocks++]=lockid;
333334

334335
/*
@@ -397,7 +398,8 @@ LWLockConditionalAcquire(LWLockId lockid, LWLockMode mode)
397398
else
398399
{
399400
/* Add lock to list of locks held by this backend */
400-
Assert(num_held_lwlocks<MAX_SIMUL_LWLOCKS);
401+
if (num_held_lwlocks >=MAX_SIMUL_LWLOCKS)
402+
elog(ERROR,"too many LWLocks taken");
401403
held_lwlocks[num_held_lwlocks++]=lockid;
402404
}
403405

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp