Re: Readme of Buffer Management seems to have wrong sentence - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Readme of Buffer Management seems to have wrong sentence
Date
Msg-id CA+TgmoYTiYuvppCiZOby+FSdEigqxok2gGgvk663dkkTkJe3Ug@mail.gmail.com
Whole thread Raw
In response to Readme of Buffer Management seems to have wrong sentence  (Amit Kapila <amit.kapila@huawei.com>)
Responses Re: Readme of Buffer Management seems to have wrong sentence
List pgsql-hackers
On Tue, May 8, 2012 at 9:37 PM, Amit Kapila <amit.kapila@huawei.com> wrote:
> I have checked the code and logic according to which usage counter is
> increased when the buffer is pinned.

Fixed, thanks for the report.

> Another Doubt : Why in function BufferAlloc, it needs to hold the
> BufFreelistLock till it pin the buffer which increases its reference count.

Well, I think the problem is that, if we didn't do that, then, in
theory, the strategy point could wrap all the way around
shared_buffers and someone else could pin the buffer, and then we'd be
hosed.

Mind you, I think this whole area of the code needs some reengineering
for better performance, but I'm not sure this is the right place to
start.  What I think is really bad is that we're forcing every
BufferAlloc() to iterate over buffers checking whether each one is
evictable.  I think we ought to put only those buffers that we think
are likely to be evictable on the freelist, and then the actual buffer
eviction code would only need to recheck that nothing had changed,
instead of needing to scan over a potentially quite large number of
buffers that never had any chance of being selected in the first
place.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: Thom Brown
Date:
Subject: Re: Per-Database Roles
Next
From: Robert Haas
Date:
Subject: Re: enhanced error fields