Re: Tablespaces in the data directory - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: Tablespaces in the data directory
Date
Msg-id 50BCEC06.8060501@dunslane.net
Whole thread Raw
In response to Re: Tablespaces in the data directory  (Magnus Hagander <magnus@hagander.net>)
Responses Re: Tablespaces in the data directory
List pgsql-hackers
On 12/03/2012 12:33 PM, Magnus Hagander wrote:
>
>
> On Dec 3, 2012 2:55 AM, "Andrew Dunstan" <andrew@dunslane.net 
> <mailto:andrew@dunslane.net>> wrote:
> >
> >
> > On 12/02/2012 07:50 PM, Magnus Hagander wrote:
> >>
> >> On Sat, Dec 1, 2012 at 6:56 PM, Tom Lane <tgl@sss.pgh.pa.us 
> <mailto:tgl@sss.pgh.pa.us>> wrote:
> >>>
> >>> Magnus Hagander <magnus@hagander.net <mailto:magnus@hagander.net>> 
> writes:
> >>>>
> >>>> Someone just reported a problem when they had created a new 
> tablespace
> >>>> inside the old data directory. I'm sure there can be other issues
> >>>> caused by this as well, but this is mainly a confusing scenario for
> >>>> people now.
> >>>> As there isn't (as far as I know at least) any actual *point* in
> >>>> creating a tablespace inside the main data directory, should we
> >>>> perhaps disallow this in CREATE TABLESPACE? Or at least throw a
> >>>> WARNING if one does it?
> >>>
> >>> It could be pretty hard to detect that in general (think symlinks
> >>> and such).  I guess if we're just trying to print a helpful warning,
> >>> we don't have to worry about extreme corner cases.  But what exactly
> >>> do you have in mind --- complain about any relative path?  Complain
> >>> about absolute paths that have a prefix matching the DataDir?
> >>
> >> Oh, I hadn't thought quite so far as the implementation :) Was looking
> >> to see if there were going to be some major objections before I even
> >> started thinking about that.
> >>
> >> But for the implementation, I'd say any absolute path that have a
> >> prefix matching DataDir. Tablespaces cannot be created using relative
> >> paths, so we don't have to deal with that.
> >>
> >
> > I have been known to symlink a tablespace on a replica back to a 
> directory in the datadir, while on the primary it points elsewhere. 
> What exactly is the problem?
>
> That wouldn't be affected by this though, since it would only warn at 
> create tablespace.
>
> I'd still consider it a bad idea in general to do that, since you're 
> basically messing with the internal structure of the data directory. 
> Why not just link it to some place outside the data directory?
>
> One obvious problem with it atm is that pg_basebackup breaks, in that 
> it backs up your data twice, and throws warnings about things that 
> aren't links if you actually out it inside pg_tblspc.
>
>

Well, when I last did it I don't think there was such a thing as 
pg_basebackup :-)

I think it would be reasonable for it to complain if it came across a 
PG_VERSION file in an unexpected location.

cheers

andrew




pgsql-hackers by date:

Previous
From: Dimitri Fontaine
Date:
Subject: Re: Review: create extension default_full_version
Next
From: Pavan Deolasee
Date:
Subject: visibilitymap_count() at the end of vacuum