Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYDQW-0005QQ-U6 for pgsql-admin@arkaria.postgresql.org; Mon, 30 Jan 2017 14:59:29 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cYDQV-0002i2-RM for pgsql-admin@arkaria.postgresql.org; Mon, 30 Jan 2017 14:59:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cYDOo-0000ng-8l for pgsql-admin@postgresql.org; Mon, 30 Jan 2017 14:57:42 +0000 Received: from host3.dynacom.ondsl.gr ([62.103.35.211] helo=smadev.internal.net) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cYDOk-0003KH-9L for pgsql-admin@postgresql.org; Mon, 30 Jan 2017 14:57:41 +0000 Received: from smadev.internal.net (smadev [10.9.200.131]) by smadev.internal.net (8.15.2/8.15.2) with ESMTP id v0UEvXwG005428 for ; Mon, 30 Jan 2017 16:57:33 +0200 (EET) (envelope-from achill@matrix.gatewaynet.com) Subject: Re: Tablespace symlinks To: pgsql-admin@postgresql.org References: From: Achilleas Mantzios Message-ID: <588F545D.1060604@matrix.gatewaynet.com> Date: Mon, 30 Jan 2017 16:57:33 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------090502010307070501020407" X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org This is a multi-part message in MIME format. --------------090502010307070501020407 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit tar != "the server" . The doc tells you the server will consult /tablespace_map. /What does this file look like in your base.tar.gz ? On 30/01/2017 16:24, Slavcho Trnkovski wrote: > Hi, > I'm using PostgreSQL 9.5. > As backup I use pg_basebackup with options /--format=t -v -z -P /. > These are the steps I do for restore: > 1. > tar -xzf base.tar.gz -C $PGDATA > 2. > for f in `ls | grep -v base.tar.gz `; do > echo "tar -xf $f -C $PGDATA/pg_tblspc/`echo $f|cut -d'.' -f 1`" > tar -xf $f -C $PGDATA/pg_tblspc/`echo $f|cut -d'.' -f 1` > done > > I​ ha > ​ v​ > e​ > ​ problem because ​symlinks for my tablespaces are not being created in step 1. > > ​ According to https://www.postgresql.org/docs/9.5/static/app-pgbasebackup.html : > "/When tar format mode is used, it is the user's responsibility to unpack each tar file before starting the PostgreSQL server. If there are additional tablespaces, the tar files for them need to be > unpacked in the correct locations. In this case the symbolic links for those tablespaces will be created by the server according to the contents of the tablespace_map file that is included in the > base.tar// file./" > my understanding is that these symbolic links should be created with the first step. > > I was using same approach with PostgreSQL 9.4, and it was OK. > > So, is this new behavior in 9.5 (so I shall handle it manually), or I am missing something? > > Regards, > Slavcho > > -- Achilleas Mantzios IT DEV Lead IT DEPT Dynacom Tankers Mgmt --------------090502010307070501020407 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
tar != "the server" . The doc tells you the server will consult tablespace_map. What does this file look like in your base.tar.gz ?

On 30/01/2017 16:24, Slavcho Trnkovski wrote:
Hi,
I'm using PostgreSQL 9.5.
As backup I use pg_basebackup with options --format=t -v -z -P .
These are the steps I do for restore:
1. 
tar -xzf base.tar.gz -C $PGDATA
2. 
for f in `ls | grep -v base.tar.gz `; do
echo "tar  -xf $f -C $PGDATA/pg_tblspc/`echo $f|cut -d'.' -f 1`" 
tar -xf $f -C $PGDATA/pg_tblspc/`echo $f|cut -d'.' -f 1`

done

I​ ha
​ v​
e​
​ problem because ​symlinks for my tablespaces are not being created in step 1.

"When tar format mode is used, it is the user's responsibility to unpack each tar file before starting the PostgreSQL server. If there are additional tablespaces, the tar files for them need to be unpacked in the correct locations. In this case the symbolic links for those tablespaces will be created by the server according to the contents of the tablespace_map file that is included in the base.tar file."
my understanding is that these symbolic links should be created with the first step.

I was using same approach with PostgreSQL 9.4, and it was OK.

So, is this new behavior in 9.5 (so I shall handle it manually), or I am missing something?

Regards,
Slavcho




-- 
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt
--------------090502010307070501020407--