Re: [PATCH] Relocation of tablespaces in pg_basebackup

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Steeve Lennmark <steevel(at)handeldsbanken(dot)se>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Relocation of tablespaces in pg_basebackup
Date: 2014-01-09 18:18:06
Message-ID: CABUevExbDEUmNM6nttL8kiE14Y_uLPt=yBBZDRUK+oOCAcpH4A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 9, 2014 at 6:58 PM, Steeve Lennmark
<steevel(at)handeldsbanken(dot)se>wrote:

> Currently pg_basebackup is pretty invasive when using tablespaces, at
> least using the plain format. This since it requires the tablespace to
> be written to the same location as on the server beeing backed up. This
> both breaks backing up locally using -Fp (since the tablespace would
> be written to the same location) and requires the backup user to have
> write permissions in locations it shouldn't need to have access to.
>

Yeah, this has been sitting on my TODO for a long time :) Glad to see
someone is picking it up.

This patch adds the ability to relocate tablespaces by adding the
> command line argument --tablespace (-T) which takes a required argument
> in the format "oid:tablespacedir". After all tablespaces are fetched
> this code updates the symlink to point to the new tablespace location.
>
> I would have loved to be able to pass tablespacename:tablespacedir
> though, but sadly I wasn't able to figure out how to retrieve that
> information without creating another connection to the database.
>

You could also use the format "olddir:newdir", because you do know that.
It's not the name of the tablespace. but I think it's still more
usefriendly than using the oid.

This feature might be missing because of some other limitation I fail
> to see, if so let me know. Please be gentle, this is my first patch ;-)
>

Nope, I think it's just been limited on time.

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2014-01-09 18:18:36 Re: [BUG] Archive recovery failure on 9.3+.
Previous Message Steeve Lennmark 2014-01-09 18:17:16 Re: [PATCH] Relocation of tablespaces in pg_basebackup