Re: _pg_relbuf() Relation paramter - Mailing list pgsql-hackers

From Tom Lane
Subject Re: _pg_relbuf() Relation paramter
Date
Msg-id 3818.1423064449@sss.pgh.pa.us
Whole thread Raw
In response to Re: _pg_relbuf() Relation paramter  (Heikki Linnakangas <hlinnakangas@vmware.com>)
List pgsql-hackers
Heikki Linnakangas <hlinnakangas@vmware.com> writes:
> ... (there's a call to _bt_relbuf in contrib/pgstattuple, but it 
> shouldn't really be used in 3rd party extensions)

Meh.  I wouldn't say that.  I agree that the coding in pgstat_btree_page
pretty much sucks, but on grounds of lack of consistency rather than that
this shouldn't be considered an exported function.  I've not checked the
commit history, but I bet what happened is that that function originally
used _bt_getbuf and _bt_relbuf, which I would say is perfectly appropriate
for something touching pages of a btree index.  Then somebody decided they
wanted to make use of a BufferAccessStrategy, so they drilled down through
the _bt_getbuf abstraction layer, but they didn't drill down through
_bt_relbuf at the same time.  Which is inconsistent, and could even be the
source of a bug in future if we ever made _bt_getbuf/_bt_relbuf do things
differently than they do now.

So I'd definitely be in favor of replacing pgstat_btree_page's use of it
with a direct call on UnlockReleaseBuffer; and for that matter, since it's
abandoned reliance on nbtree's buffer access infrastructure, it should
not be using the BT_READ macro either.  But changing nbtree's own internal
coding patterns is a different question.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: _pg_relbuf() Relation paramter
Next
From: Steven Lembark
Date:
Subject: Re: Release note bloat is getting out of hand