Re: Auto create (top level) directory for create tablespace

From: Mark Kirkwood <markir(at)paradise(dot)net(dot)nz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Auto create (top level) directory for create tablespace
Date: 2007-12-16 03:56:09
Message-ID: 4764A1D9.3060406@paradise.net.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Tom Lane wrote:
> Mark Kirkwood <markir(at)paradise(dot)net(dot)nz> writes:
>
>> I thought it made sense for CREATE TABLESPACE to attempt to create the
>> top level location directory -
>>
>
> I thought we had deliberately made it not do that. Auto-recreate during
> replay sounds even worse. The problem is that a tablespace would
> normally be under a mount point, and auto-create has zero chance of
> getting such a path right.
>
> Ignoring this point is actually a fine recipe for destroying your data;
> see Joe Conway's report a couple years back about getting burnt by a
> soft NFS mount. If the DB directory is not there, auto-creating it is
> a horrible idea.
>
>

Hmm - ok, unmounted filesystems could bite you. However, they could bite
folks creating the directory manually too...(I guess you could argue it
is less likely though).

On the replay front, the use case I was thinking about is standby
database - the classic foot gun there is to create a tablespace on
source box and forget to add the appropriate directory on the target....
and bang! replay fails.

It does seem to me like there are scenarios where either behavior is
undesirable... a possible option is a configuration parameter to choose
between auto creation or not. However I'm happy to go with the consensus
here - if its universally deemed to be a terrible idea, then let's ditch
the patch :-)

Best wishes

Mark

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2007-12-16 08:57:07 Re: Wrong result with pgbench -C option?
Previous Message Tom Lane 2007-12-16 03:28:02 Re: Auto create (top level) directory for create tablespace