Unix Technical Forum

Auto create (top level) directory for create tablespace

This is a discussion on Auto create (top level) directory for create tablespace within the Pgsql Patches forums, part of the PostgreSQL category; --> I thought it made sense for CREATE TABLESPACE to attempt to create the top level location directory - and ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Patches

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2008, 06:24 AM
Mark Kirkwood
 
Posts: n/a
Default Auto create (top level) directory for create tablespace

I thought it made sense for CREATE TABLESPACE to attempt to create the
top level location directory - and also for tablespace redo to do
likwewise during WAL replay.

Tablespace creation then behaves a bit more like intidb with respect to
directory creation, which I found quite nice.

Patch against HEAD, passes regression tests.

Cheers

Mark


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-19-2008, 06:24 AM
Tom Lane
 
Posts: n/a
Default Re: Auto create (top level) directory for create tablespace

Mark Kirkwood <markir@paradise.net.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.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-19-2008, 06:24 AM
Mark Kirkwood
 
Posts: n/a
Default Re: Auto create (top level) directory for create tablespace

Tom Lane wrote:
> Mark Kirkwood <markir@paradise.net.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

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-19-2008, 06:24 AM
Peter Eisentraut
 
Posts: n/a
Default Re: Auto create (top level) directory for create tablespace

Tom Lane wrote:
> 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.


Yes, this would be equivalent to the old behavior of the Red Hat RPMs that
automatically performed initdb if the data directory is missing. Thankfully,
that has been abolished.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:30 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com