From: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com> |
---|---|
To: | Uwe Bartels <uwe(dot)bartels(at)gmail(dot)com> |
Cc: | "Nicholson, Brad (Toronto, ON, CA)" <bnicholson(at)hp(dot)com>, "tv(at)fuzzy(dot)cz" <tv(at)fuzzy(dot)cz>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: buffercache/bgwriter |
Date: | 2011-03-23 16:01:51 |
Message-ID: | AANLkTimA4-s1hntzZp5bXbCMGhOru4qk+Ft1WXGt_-Rs@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On Wed, Mar 23, 2011 at 8:26 AM, Uwe Bartels <uwe(dot)bartels(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Uwe Bartels | 2011-03-23 16:16:17 | Re: buffercache/bgwriter |
Previous Message | Jeff Janes | 2011-03-23 15:36:53 | Re: buffercache/bgwriter |