Re: tablespaces inside $PGDATA considered harmful

From: Mark Kirkwood <mark(dot)kirkwood(at)catalyst(dot)net(dot)nz>
To: Bruce Momjian <bruce(at)momjian(dot)us>, Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: tablespaces inside $PGDATA considered harmful
Date: 2017-09-26 07:44:49
Message-ID: e15ce21a-ed57-7305-0e91-9d508e8ad528@catalyst.net.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 29/04/15 09:35, Bruce Momjian wrote:

> On Fri, Apr 24, 2015 at 01:05:03PM -0400, Bruce Momjian wrote:
>> This way, both pg_dump and pg_upgrade will issue warnings, though, of
>> course, those warnings can be ignored. I am hopeful these two warnings
>> will be sufficient and we will not need make these errors, with the
>> possible inconvenience it will cause. I am still afraid that someone
>> will ignore the new errors pg_dump would generate and lose data. I just
>> don't remember enough cases where we threw new errors on _data_ restore.
>>
>> Frankly, those using pg_upgrade already will have to move the old
>> tablespaces out of the old cluster if they ever want to delete those
>> clusters, so I am hopeful these additional warnings will help eliminate
>> this practice, which is already cumbersome and useless. I am not
>> planning to revisit this for 9.6.
>

(resurrecting an old thread) I encountered this the other day, a
customer had created tablespaces with directories inside
$PGDATA/pg_tblspc. This is just pathalogical - e.g (v11 checkout with
PGDATA=/data0/pgdata/11):

bench=# CREATE TABLESPACE space1 LOCATION
'/data0/pgdata/11/pg_tblspc/space1';
WARNING:  tablespace location should not be inside the data directory
CREATE TABLESPACE
bench=# ALTER TABLE pgbench_accounts SET  TABLESPACE space1;
ALTER TABLE

Ok, so I've been warned:

$ pg_basebackup -D .
WARNING:  could not read symbolic link "pg_tblspc/space1": Invalid argument
pg_basebackup: directory "/data0/pgdata/11/pg_tblspc/space1" exists but
is not empty
pg_basebackup: removing contents of data directory "."

So pg_basebackup is completely broken by this construction - should we
not prohibit the creation of tablespace directories under $PGDATA (or at
least $PGDATA/pg_tblspc) at this point?

regards

Mark

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2017-09-26 07:55:49 Re: Built-in plugin for logical decoding output
Previous Message Amit Langote 2017-09-26 07:39:14 Re: Setting pd_lower in GIN metapage