Re: buffercache/bgwriter

Поиск
Список
Период
Сортировка
От Jeff Janes
Тема Re: buffercache/bgwriter
Дата
Msg-id AANLkTimA4-s1hntzZp5bXbCMGhOru4qk+Ft1WXGt_-Rs@mail.gmail.com
обсуждение исходный текст
Ответ на Re: buffercache/bgwriter  (Uwe Bartels <uwe.bartels@gmail.com>)
Список pgsql-performance
On Wed, Mar 23, 2011 at 8:26 AM, Uwe Bartels <uwe.bartels@gmail.com> wrote:
> Hi Brad,
>
> yes. that's the question....
> in the source code in freelist.c there is something that I don't understand.
>
> This is the first try to get a free page. The second try scans used buffers.
> What makes me wonder is the why postgres is checking for <<buf->usage_count
> == 0>>
> where usage_count is supposed to be NULL initially.

The code comment preceding that check seems to explain that it is
probably not needed but simply done from an abundance of caution.

>         /*
>          * If the buffer is pinned or has a nonzero usage_count, we cannot
> use
>          * it; discard it and retry.  (This can only happen if VACUUM put a
>          * valid buffer in the freelist and then someone else used it before
>          * we got to it.  It's probably impossible altogether as of 8.3, but
>          * we'd better check anyway.)

Seems like maybe an Assert would be called for.

Cheers,

Jeff

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

Предыдущее
От: Uwe Bartels
Дата:
Сообщение: Re: buffercache/bgwriter
Следующее
От: Josh Berkus
Дата:
Сообщение: Shouldn't we have a way to avoid "risky" plans?