Re: Use of non-restart-safe storage by temp_tablespaces

From: Mark Dilger <hornschnorter(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Use of non-restart-safe storage by temp_tablespaces
Date: 2017-05-31 14:53:22
Message-ID: F15052D0-5494-4BBC-8D89-121D468C3FEB@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> On May 31, 2017, at 6:04 AM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
>
> On Wed, May 31, 2017 at 07:53:53AM -0400, Robert Haas wrote:
>> On Tue, May 30, 2017 at 6:50 PM, Mark Dilger <hornschnorter(at)gmail(dot)com> wrote:
>>>> On May 29, 2017, at 11:53 AM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
>>>> Right now we don't document that temp_tablespaces can use
>>>> non-restart-safe storage, e.g. /tmp, ramdisks. Would this be safe?
>>>> Should we document this?
>>>
>>> The only safe way to do temporary tablespaces that I have found is to extend
>>> the grammar to allow CREATE TEMPORARY TABLESPACE, and then refuse
>>> to allow the creation of any non-temporary table (or index on same) in that
>>> tablespace. Otherwise, it is too easy to be surprised to discover that your
>>> table contents have gone missing.
>>
>> I think this would be a sensible approach.
>
> Just to clarify, the TEMPORARY clause would allow the tablespace to
> start up empty, while normal tablespaces can't do that, right? One big
> problem is that we don't have any way to prevent non-temporary
> tablespaces from being created on transient storage. I wonder if we
> should document this restriction, but it seems awkward to do.

It depends what you mean by allowing the tablespace to start up empty.
It must not be empty once users can run queries, since the catalogs will still
have entries for the tablespace and its dependent objects. So, what must
happen is that during startup the tablespace and its temporary tables and
indexes get recreated if they are missing.

Mark Dilger

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-05-31 14:57:49 Re: POC: Sharing record typmods between backends
Previous Message Robert Haas 2017-05-31 14:52:08 Re: Effect of changing the value for PARALLEL_TUPLE_QUEUE_SIZE