Re: Fix spinlock usage in UnpinBuffer()

Поиск
Список
Период
Сортировка
От Qingqing Zhou
Тема Re: Fix spinlock usage in UnpinBuffer()
Дата
Msg-id Pine.LNX.4.58.0512281754100.13811@eon.cs
обсуждение исходный текст
Ответ на Re: Fix spinlock usage in UnpinBuffer()  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches

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

В списке pgsql-patches по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Fix spinlock usage in UnpinBuffer()
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Fix spinlock usage in UnpinBuffer()