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

From Tom Lane
Subject Re: Minor fix in lwlock.c
Date
Msg-id 9304.1112937642@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:
> I guess the problem is here:

>  /*
>   * Fix the process wait semaphore's count for any absorbed wakeups.
>   */
>  while (extraWaits-- > 0)
>   PGSemaphoreUnlock(&proc->sem);

Mmm.  Could be a problem, but the chances of having extraWaits>0 is
really pretty small.  In any case, FATAL doesn't fix this, because
it will still try to go through normal backend exit cleanup which
requires having working LWLock support.  If you take the above risk
seriously then you need a PANIC error.

The alternative would be to move the Unlock loop in front of the
addition of the LWLock to held_lwlocks[], but I think that cure
is probably worse than the disease --- the chance of an error during
Unlock seems nonzero.

            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