Re: Calling PrepareTempTablespaces in BufFileCreateTemp

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Geoghegan <pg(at)bowt(dot)ie>
Cc: Melanie Plageman <melanieplageman(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Calling PrepareTempTablespaces in BufFileCreateTemp
Date: 2019-04-24 19:17:06
Message-ID: 11777.1556133426@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> Here's a draft patch for that.
>
> It's slightly ugly that this adds a dependency on commands/tablespace
> to fd.c, which is a pretty low-level module. I think wanting to avoid
> that layering violation might've been the reason for doing things the
> way they are. However, this gets rid of tablespace dependencies in
> some other files that are only marginally higher-level, like
> tuplesort.c, so I'm not sure how strong that objection is.
>
> There are three functions in fd.c that have a dependency on the
> temp tablespace info having been set up:
> OpenTemporaryFile
> GetTempTablespaces
> GetNextTempTableSpace
> This patch makes the first of those automatically set up the info
> if it's not done yet. The second one has always had an assertion
> that the caller did it already, and now the third one does too.

After a bit more thought it seemed like another answer would be to
make all three of those functions assert that the caller did the
right thing, as per attached. This addresses the layering-violation
complaint, but might be more of a pain in the rear for developers.

Not really sure which way I like better.

regards, tom lane

Attachment Content-Type Size
assert-that-temp-tablespaces-are-prepared.patch text/x-diff 1.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashwin Agrawal 2019-04-24 19:19:20 Re: Zedstore - compressed in-core columnar storage
Previous Message Melanie Plageman 2019-04-24 19:08:24 Re: Calling PrepareTempTablespaces in BufFileCreateTemp