On Wed, 28 Dec 2005, Tom Lane wrote:
>
> Because the code uses _NoHoldoff, there won't be any check of
> InterruptPending in that segment of code.
I guess the danger I claimed may not really happen because of the
"ImmediateInterruptOK" variable. Since it is almost always false (except
reading inputs and some very limited local usage), so even we don't
HOLD_INTERRUPTS() in UnpinBuffer(), we are still protected by this
variable in die() when a SIGTERM sneaks in. -- But this is dangerous
AFAICS, since we must gaurantee that nowhere during holding BufHdrLock
will invoke CHECK_FOR_INTERRUPTS(), which is *not* protected by
"ImmediateInterruptOK".
In other words, if we agree that the above behavior is safe, then we can
use _NoHoldoff in almost the whole buffer manager code on condition that
we are sure that no CHECK_FOR_INTERRUPTS() invoked while holding spinlock.
So for example, in UnlockBuffers(), remove the HOLD_INTERRUPTS() pair; in
write_buffer(), change LockBufHdr() to LockBufferHdr_NoHoldoff().
Regards,
Qingqing