Re: [PATCH] Relocation of tablespaces in pg_basebackup
От | Steeve Lennmark |
---|---|
Тема | Re: [PATCH] Relocation of tablespaces in pg_basebackup |
Дата | |
Msg-id | CADAK8w4viJ5PnGO2jAqRK6Va=SuOCr+0St9oOJpsFDgXvqsRGg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [PATCH] Relocation of tablespaces in pg_basebackup (Magnus Hagander <magnus@hagander.net>) |
Ответы |
Re: [PATCH] Relocation of tablespaces in pg_basebackup
Re: [PATCH] Relocation of tablespaces in pg_basebackup |
Список | pgsql-hackers |
On Thu, Jan 9, 2014 at 7:18 PM, Magnus Hagander <magnus@hagander.net> wrote:
On Thu, Jan 9, 2014 at 6:58 PM, Steeve Lennmark <steevel@handeldsbanken.se> wrote:This patch adds the ability to relocate tablespaces by adding thecommand line argument --tablespace (-T) which takes a required argumentin the format "oid:tablespacedir". After all tablespaces are fetchedthis code updates the symlink to point to the new tablespace location.I would have loved to be able to pass tablespacename:tablespacedirthough, but sadly I wasn't able to figure out how to retrieve thatinformation 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
Вложения
В списке pgsql-hackers по дате отправления: