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.p...@pinaraf.info> > wrote in <2008148.rxBNyNRHPZ@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. > > https://www.postgresql.org/docs/9.6/static/manage-ag-tablespaces.html > > | 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. Pierre -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers