From: | Simon Riggs <simon(at)2ndQuadrant(dot)com> |
---|---|
To: | Amit Khandekar <amit(dot)khandekar(at)enterprisedb(dot)com> |
Cc: | Abhijit Menon-Sen <ams(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [PATCH] introduce XLogLockBlockRangeForCleanup() |
Date: | 2014-07-03 11:29:34 |
Message-ID: | CA+U5nMLSHYFkwTaHFg+jO3gvOL3aUOkEeWZUwXBOhgM-KBEyyQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 3 July 2014 06:45, Amit Khandekar <amit(dot)khandekar(at)enterprisedb(dot)com> wrote:
> In GetBufferWithoutRelcache(), I was wondering, rather than calling
> PinBuffer(), if we do this :
> LockBufHdr(buf);
> PinBuffer_Locked(buf);
> valid = ((buf->flags & BM_VALID) != 0);
> then we can avoid having the new buffer access strategy BAS_DISCARD that is
> introduced in this patch. And so the code changes in freelist.c would not be
> necessary.
That looks like a good idea, thanks.
I think we should say this though
LockBufHdr(buf);
valid = ((buf->flags & BM_VALID) != 0);
if (valid)
PinBuffer_Locked(buf);
else
UnlockBufHdr(buf);
since otherwise we would access the buffer flags without the spinlock
and we would leak a pin if the buffer was not valid
--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Fujii Masao | 2014-07-03 12:27:53 | Re: gaussian distribution pgbench |
Previous Message | Abhijit Menon-Sen | 2014-07-03 10:51:59 | Re: [PATCH] introduce XLogLockBlockRangeForCleanup() |