Re: pgsql: Remove BufFile's isTemp flag. - Mailing list pgsql-committers

From Tom Lane
Subject Re: pgsql: Remove BufFile's isTemp flag.
Date
Msg-id 32216.1510935834@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgsql: Remove BufFile's isTemp flag.  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pgsql: Remove BufFile's isTemp flag.  (Peter Geoghegan <pg@bowt.ie>)
Re: pgsql: Remove BufFile's isTemp flag.  (Andres Freund <andres@anarazel.de>)
List pgsql-committers
I wrote:
> Andres Freund <andres@anarazel.de> writes:
>> On 2017-11-16 21:58:14 -0500, Tom Lane wrote:
>>> [ squint... ]  That used to have an actual purpose connected to
>>> transaction-abort cleanup, IIRC.  It disturbs me that this seems
>>> to have been lost.

>> I've not found any such use, searching through buffile.c's history. I
>> don't quite see how that flag could've been related to abort cleanup
>> stuff?  There's been another unused caller of makeBufFile, namely
>> BufFileCreate, that has been #ifdef'ed out for ages (perhaps we
>> should've removed that with this commit or a long time ago).  Other than
>> that there seems to not have been any other caller setting that flag
>> differently since you created the file in db3c4c3a2d980dcd.

OK, after looking through the history, the reason for isTemp = false
is indeed to allow BufFileCreate() to maintain its old semantics,
wherein you could attach a BufFile to an already-existing, possibly
non-temp file.  There have not been any core callers of BufFileCreate()
in a long time (maybe not since that commit, in fact), but I imagine
I left it alone for fear that extensions might be using it.  I see though
that Bruce ifdef'd it out in 20ad43b5, so there aren't any extensions
using it either.

We should flat-out remove the function, since this change makes it
impossible to resurrect with its old semantics.  I wonder whether
we should then rename BufFileCreateTemp to just BufFileCreate,
since it's no longer possible to have a BufFile that isn't temp.
I suspect that some attention to the comments might be needed too.

Or maybe we should revert 11e264517.  It doesn't seem to be buying
much to make up for the loss of flexibility.
        regards, tom lane


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pgsql: Remove BufFile's isTemp flag.
Next
From: Robert Haas
Date:
Subject: pgsql: Set proargmodes for satisfies_hash_partition.