Re: [RFC, POC] Don't require a NBuffer sized PrivateRefCount array of local buffer pins

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [RFC, POC] Don't require a NBuffer sized PrivateRefCount array of local buffer pins
Date: 2014-08-27 02:04:03
Message-ID: CA+TgmobcNGBpL+UKza4aXcOsX-=y2PCmX=ysayKvknA0VTS=BA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Aug 26, 2014 at 7:52 PM, Andres Freund <andres(at)2ndquadrant(dot)com> wrote:
> Here's the next version of this patch.

+ * much never requried. So we keep a small array of reference counts

Typo. But I think you could just drop the whole sentence about how
things used to be, especially since it's recapitulated elsewhere.

+#define REFCOUNT_ARRAY_ENTRIES 8 /* one full cacheline */

Obviously that's not always going to be the case. You could say
"about", or just drop the comment. Shouldn't "cache line" be two
words?

+ * refcounts are kept track of in the array, after that new array entries

s/, after that/; after that,/

+ if (!found && !create)
+ else if (!found && free != NULL)
+ else if (!found)
+ else if (found && !do_move)
+ else if (found && free != NULL)
+ else if (found)
+ Assert(false); /* unreachable */
+ return res;

There's not much point in testing found when you've already handled
the not-found cases. But I'd reorganize this whole thing like this:

if (!found) { if (!create) { return; } if (free != NULL) { stuff;
return }; stuff; return; }
if (!do_move) { return; } if (free != NULL) { stuff; return; } stuff; return;

+ * Stop tracking the refcount of the buffer ref is tracking the refcount
+ * for. Nono, there's no circularity here.

Incomprehensible babble. Perhaps: "Release resources used to track
the reference count of a buffer which we no longer have pinned."

That's all I see on a first-read through. There might be other
issues, and I haven't checked through it in great detail for mundane
bugs, but generally, I favor pressing on relatively rapidly toward a
commit. It seems highly likely that this idea is a big win, and if
there's some situation in which it's a loss, we're more likely to find
out with it in the tree (and thus likely to be tested by many more
people) than by analysis from first principles.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-08-27 02:06:55 Re: Compute attr_needed for child relations (was Re: inherit support for foreign tables)
Previous Message Michael Paquier 2014-08-27 02:02:40 Re: Concurrently option for reindexdb