Re: Bug with pg_basebackup and 'shared' tablespace

From: Pierre Ducroquet <p(dot)psql(at)pinaraf(dot)info>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Bug with pg_basebackup and 'shared' tablespace
Date: 2017-04-06 10:34:09
Message-ID: 1714428.BHRm6e8A2D@peanuts2
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thursday, April 6, 2017 2:00:55 PM CEST Kyotaro HORIGUCHI wrote:
> At Thu, 06 Apr 2017 00:59:49 +0200, Pierre Ducroquet <p(dot)psql(at)pinaraf(dot)info>
> wrote in <2008148(dot)rxBNyNRHPZ(at)peanuts2>
> > But it all gets messy when we want to create a streaming standby server
> > using pg_basebackup. When backuping Pg 9.5, there is no issue, but
> > backuping Pg 9.6 afterwards will say "directory "/mnt/ssd/postgres"
> > exists but is not empty".
> The documentation says as follows.
> | The location must be an existing, empty directory that is owned
> | by the PostgreSQL operating system user.
> This explicitly prohibits to share one tablespace directory among
> multiple servers. The code is just missing the case of multiple
> servers with different versions. I think the bug is rather that
> Pg9.6 in the case allowed to create the tablespace.
> The current naming rule of tablespace directory was introduced as
> of 9.0 so that pg_upgrade (or pg_migrator at the time) can
> perform in-place migration. It is not intended to share a
> directory among multiple instances with different versions.
> That being said, an additional trick in the attached file will
> work for you.

Thanks for your answer.
Indeed, either PostgreSQL should enforce that empty folder restriction, or
pg_basebackup should lift it and the documentation should reflect this.
Right now, there is a conflict between pg_basebackup and the server since they
do not allow the same behaviour. I can submit a patch either way, but I won't
decide what is the right way to do it.
I know tricks will allow to work around that issue, I found them hopefully and
I guess most people affected by this issue would be able to find and use them,
but nevertheless being able to build a server that can no longer be base-
backuped does not seem right.


In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2017-04-06 10:40:26 Re: Other formats in pset like markdown, rst, mediawiki
Previous Message Andrew Dunstan 2017-04-06 10:30:07 Re: PoC plpgsql - possibility to force custom or generic plan