Re: Calling PrepareTempTablespaces in BufFileCreateTemp - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Calling PrepareTempTablespaces in BufFileCreateTemp
Date
Msg-id 26568.1556660215@sss.pgh.pa.us
Whole thread Raw
In response to Re: Calling PrepareTempTablespaces in BufFileCreateTemp  (Melanie Plageman <melanieplageman@gmail.com>)
Responses Re: Calling PrepareTempTablespaces in BufFileCreateTemp  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Melanie Plageman <melanieplageman@gmail.com> writes:
> I also think that if there is a step that a caller should always take before
> calling a function, then there needs to be a very compelling reason not to
> move that step into the function itself.

Fair complaint.

> PrepareTempTablespaces should not be called in BufFileCreateTemp because
> it is not concerned with temp tablespaces.

Actually, my reason for thinking that was mostly "that won't fix the
problem, because what about other callers of OpenTemporaryFile?"

However, looking around, there aren't any others --- buffile.c is it.

So maybe a reasonable compromise is to add the Assert(s) in fd.c as
per previous patch, but *also* add PrepareTempTablespaces in
BufFileCreateTemp, so that at least users of buffile.c are insulated
from the issue.  buffile.c is still kind of low-level, but it's not
part of core infrastructure in the same way as fd.c, so probably I could
hold my nose for this solution from the system-structural standpoint.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Melanie Plageman
Date:
Subject: Re: Calling PrepareTempTablespaces in BufFileCreateTemp
Next
From: Souvik Bhattacherjee
Date:
Subject: Re: Initializing LWLock Array from Server Code