Re: Move unused buffers to freelist

From: Amit Kapila <amit(dot)kapila(at)huawei(dot)com>
To: "'Jim Nasby'" <jim(at)nasby(dot)net>, "'Greg Smith'" <greg(at)2ndQuadrant(dot)com>
Cc: "'PostgreSQL-development'" <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: Move unused buffers to freelist
Date: 2013-05-24 06:55:29
Message-ID: 006001ce584b$adfc55f0$09f501d0$@kapila@huawei.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message amul sul 2013-05-24 07:20:29 Re: Patch to .gitignore
Previous Message Amit Kapila 2013-05-24 06:17:41 Re: Move unused buffers to freelist