pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Steele <david@pgmasters.net>
To: pgsql-hackers@postgresql.org
Subject: Re: tablespaces inside $PGDATA considered harmful
Date: Fri, 30 Jan 2015 12:12:01 -0500
Message-ID: <54CBBB61.1090207@pgmasters.net> (raw)
In-Reply-To: <54CBB4AB.1090805@commandprompt.com>
References: <CA+TgmobZLyLU8tFCbMqbjMWB6t+=ERaDo820uQEJCVAQK_Paow@mail.gmail.com>
	<20150130161928.GB20744@momjian.us>
	<54CBB4AB.1090805@commandprompt.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On 1/30/15 11:43 AM, Joshua D. Drake wrote:
> On 01/30/2015 08:19 AM, Bruce Momjian wrote:
>>
>> On Fri, Jan 30, 2015 at 11:12:43AM -0500, Robert Haas wrote:
>>> I think everyone who has read this mailing list for a while is
>>> probably already aware of this problem.  When you create a tablespace
>>> somewhere inside the data directory, weird things happen. If you
>>> pg_upgrade and then incautiously run the delete_old_cluster.sh script
>>> thus created, you will blow away large chunks of your data.[1]  If you
>>
>> pg_upgrade doesn't create the deletion script in this case, and warns
>> the user:
>>
>>          Could not create a script to delete the old cluster's data
>>          files because user-defined tablespaces exist in the old cluster
>>          directory.  The old cluster's contents must be deleted
>> manually.
>>
>>> In the short term, I favor just adding a warning, so that people get
>>> some clue that they are doing something that might be a bad idea.  In
>>> the long term, we might want to do more.  Thoughts?
>>
>> Yes, good idea.
>
> Uhm, wouldn't it be a rather simple patch to say:
>
> if tablespace_create() in $PGDATA:
>   ERROR!
>
> ?
>
> I mean yes a warning is good but it is after the fact, the tablespace
> is already created. We know that tablespaces in $PGDATA are a bad
> idea, why not protect the user?

I would be in favor of an error.  It would then be OK for basebackup,
pg_upgrade, and friends to error when a tablespace lives in $PGDATA,
rather than trying to deal with the situation in strange ways.

If the user really wants tablespaces in $PGDATA they can always change
the links manually in the filesystem and deal with any consequences on
their own. 

-- 
- David Steele
david@pgmasters.net

Attachments:

  signature.asc (application/pgp-signature, 818B) download

view thread (29+ messages)  latest in thread

Message-ID: <54CBBB61.1090207@pgmasters.net>
Permalink:  ../54CBBB61.1090207@pgmasters.net/
Also on:    postgresql.org/message-id/54CBBB61.1090207@pgmasters.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: david@pgmasters.net
  Subject: Re: tablespaces inside $PGDATA considered harmful
  In-Reply-To: <54CBBB61.1090207@pgmasters.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox