Skip site navigation (1) Skip section navigation (2)

Re: Moving tablespaces

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL-documentation <pgsql-docs(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Moving tablespaces
Date: 2011-12-04 16:47:11
Message-ID: CABUevEzUujCMEhmJMYxr7eQmD39moj2OPVModNZ6ENk-bg0ugQ@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-docspgsql-hackers
On Sun, Dec 4, 2011 at 17:41, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Magnus Hagander <magnus(at)hagander(dot)net> writes:
>> And IIRC, we don't actually *use* spclocation anywhere.
>
> Just for pg_dump, I think.

pg_dumpall :-)

It's also used in pg_upgrade and pg_basebackup, but those are easily
dealt with if we define a function for it.


>> How about we
>> just get rid of them as independents? We could either:
>
>> 1) Remove the column. Rely on the symlink. Create a
>> pg_get_tablespace_location(oid) function, that could be used by
>> pg_dumpall and friends, that just reads the symlink.
>
> Hm, how portable is symlink-reading?  If we can actually do that
> without big headaches, then +1.

We already use readlink in a couple of places - including getting
called from find_my_exec. It's also used in pg_basebackup. The use in
find_my_exec is conditional on HAVE_READLINK, but not the one in
backend/replication/basebackup.c. An oversight from my side when
putting that in, but it shows that every single bf member we have now
has readlink - else the whole compilation would fail, AFAICT.

It's not directly portable to win32, but we have a wrapper function
for it in port/ already.

So I think we're fairly committed to having readlink already.


>> 2) Forcibly update the spclocation column when we start the server to
>> be whatever the symlink points to. That will at least automatically
>> restore the system to being consistent.
>
> -1, running a transaction at that level will be a giant pita.
> And how would you do it at all on a hot standby slave?

yeah, it would break that usage scenario, so I'm -1 for that one as well.

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

In response to

pgsql-docs by date

Next:From: Andrew DunstanDate: 2011-12-04 16:55:41
Subject: Re: [HACKERS] Moving tablespaces
Previous:From: Tom LaneDate: 2011-12-04 16:41:30
Subject: Re: Moving tablespaces

pgsql-hackers by date

Next:From: Andrew DunstanDate: 2011-12-04 16:49:29
Subject: Re: psql setenv command
Previous:From: Tom LaneDate: 2011-12-04 16:41:30
Subject: Re: Moving tablespaces

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group