From: | Steeve Lennmark <steevel(at)handeldsbanken(dot)se> |
---|---|
To: | Magnus Hagander <magnus(at)hagander(dot)net> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [PATCH] Relocation of tablespaces in pg_basebackup |
Date: | 2014-01-09 21:10:20 |
Message-ID: | CADAK8w4viJ5PnGO2jAqRK6Va=SuOCr+0St9oOJpsFDgXvqsRGg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Jan 9, 2014 at 7:18 PM, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
> On Thu, Jan 9, 2014 at 6:58 PM, Steeve Lennmark <steevel(at)handeldsbanken(dot)se
> > wrote:
>
>> 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.
>
That's a much better solution, I attached a patch with the updated code.
# SELECT oid, pg_tablespace_location(oid) FROM pg_tablespace;
[...]
16388 | /tmp/tblspc1
16389 | /tmp/tblspc2
$ pg_basebackup -Xs -D backup/data -T /tmp/tblspc1:$(pwd)/backup/t1 -T
/tmp/tblspc2:$(pwd)/backup/t2
This produces the following now:
$ ls backup/; ls -l backup/data/pg_tblspc/
data t1 t2
lrwxrwxrwx 1 steevel users 23 Jan 9 20:41 16388 -> /home/steevel/backup/t1
lrwxrwxrwx 1 steevel users 23 Jan 9 20:41 16389 -> /home/steevel/backup/t2
--
Steeve Lennmark
Attachment | Content-Type | Size |
---|---|---|
0002-pg_basebackup-relocate-tablespace.patch | application/octet-stream | 8.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2014-01-09 21:14:10 | Re: Planning time in explain/explain analyze |
Previous Message | Jim Nasby | 2014-01-09 21:04:47 | Re: [ANNOUNCE] IMCS: In Memory Columnar Store for PostgreSQL |