Re: Move unused buffers to freelist - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: Move unused buffers to freelist
Date
Msg-id 006001ce584b$adfc55f0$09f501d0$@kapila@huawei.com
Whole thread Raw
In response to Re: Move unused buffers to freelist  (Jim Nasby <jim@nasby.net>)
List pgsql-hackers
On Friday, May 24, 2013 2:47 AM Jim Nasby wrote:
> On 5/14/13 2:13 PM, Greg Smith wrote:
> > It is possible that we are told to put something in the freelist that
> > is already in it; don't screw up the list if so.
> >
> > I don't see where the code does anything to handle that though.  What
> was your intention here?
> 
> IIRC, the code that pulls from the freelist already deals with the
> possibility that a block was on the freelist but has since been put to
> use. 

You are right, the check exists in StrategyGetBuffer()

>If that's the case then there shouldn't be much penalty to adding
> a block multiple times (at least within reason...)

There is a check in StrategyFreeBuffer() which will not allow to put
multiple times, 
I had just used the same check in new function.

With Regards,
Amit Kapila.




pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Move unused buffers to freelist
Next
From: amul sul
Date:
Subject: Re: Patch to .gitignore