Re: Bug with pg_basebackup and 'shared' tablespace

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: p(dot)psql(at)pinaraf(dot)info
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Bug with pg_basebackup and 'shared' tablespace
Date: 2017-04-06 05:00:55
Message-ID: 20170406.140055.49771299.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

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.

regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
reproduce-bug-tblspace.sh.diff text/x-patch 722 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2017-04-06 05:13:01 Re: Letting the client choose the protocol to use during a SASL exchange
Previous Message Dilip Kumar 2017-04-06 04:30:32 Re: parallel bitmapscan isn't exercised in regression tests