Re: [PATCH] introduce XLogLockBlockRangeForCleanup()

Поиск
Список
Период
Сортировка
От Simon Riggs
Тема Re: [PATCH] introduce XLogLockBlockRangeForCleanup()
Дата
Msg-id CA+U5nMLSHYFkwTaHFg+jO3gvOL3aUOkEeWZUwXBOhgM-KBEyyQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [PATCH] introduce XLogLockBlockRangeForCleanup()  (Amit Khandekar <amit.khandekar@enterprisedb.com>)
Ответы Re: [PATCH] introduce XLogLockBlockRangeForCleanup()  (Amit Khandekar <amit.khandekar@enterprisedb.com>)
Список pgsql-hackers
On 3 July 2014 06:45, Amit Khandekar <amit.khandekar@enterprisedb.com> wrote:

> In GetBufferWithoutRelcache(), I was wondering, rather than calling
> PinBuffer(), if we do this :
> LockBufHdr(buf);
> PinBuffer_Locked(buf);
> valid = ((buf->flags & BM_VALID) != 0);
> then we can avoid having the new buffer access strategy BAS_DISCARD that is
> introduced in this patch. And so the code changes in freelist.c would not be
> necessary.

That looks like a good idea, thanks.

I think we should say this though

LockBufHdr(buf);
valid = ((buf->flags & BM_VALID) != 0);
if (valid)   PinBuffer_Locked(buf);
else   UnlockBufHdr(buf);

since otherwise we would access the buffer flags without the spinlock
and we would leak a pin if the buffer was not valid

-- Simon Riggs                   http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services



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

Предыдущее
От: Abhijit Menon-Sen
Дата:
Сообщение: Re: [PATCH] introduce XLogLockBlockRangeForCleanup()
Следующее
От: Fujii Masao
Дата:
Сообщение: Re: gaussian distribution pgbench