Re: Minor fix in lwlock.c - Mailing list pgsql-patches

From Tom Lane
Subject Re: Minor fix in lwlock.c
Date
Msg-id 9818.1112942355@sss.pgh.pa.us
Whole thread Raw
In response to Re: Minor fix in lwlock.c  ("Qingqing Zhou" <zhouqq@cs.toronto.edu>)
List pgsql-patches
"Qingqing Zhou" <zhouqq@cs.toronto.edu> writes:
> "Tom Lane" <tgl@sss.pgh.pa.us> writes
>> Maybe we *should* make it a PANIC.  Thoughts?

> Reasonable. Since this should *never* happen. Once happened, that's means we
> have a serious bug in our design/coding.

Plan C would be something like

    if (num_held_lwlocks >= MAX_SIMUL_LWLOCKS)
    {
        release the acquired lock;
        elog(ERROR, "too many LWLocks taken");
    }

But we couldn't just call LWLockRelease, since it expects the lock to
be recorded in held_lwlocks[].  We'd have to duplicate a lot of code,
or split LWLockRelease into multiple routines, neither of which seem
attractive answers considering that this must be a can't-happen
case anyway.

PANIC it will be, unless someone thinks of a reason why not by
tomorrow...

            regards, tom lane

pgsql-patches by date:

Previous
From: "Qingqing Zhou"
Date:
Subject: Re: Minor fix in lwlock.c
Next
From: "Qingqing Zhou"
Date:
Subject: Re: Minor fix in lwlock.c