Re: create tablespace fails silently, or succeeds improperly

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: create tablespace fails silently, or succeeds improperly
Дата
Msg-id AANLkTinmu-6Qa780q55fg0CML=MEq=S_T-z78_m9pXg4@mail.gmail.com
обсуждение исходный текст
Ответ на Re: create tablespace fails silently, or succeeds improperly  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: create tablespace fails silently, or succeeds improperly  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Mon, Oct 18, 2010 at 3:21 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> On Mon, Oct 18, 2010 at 3:05 PM, Bruce Momjian <bruce@momjian.us> wrote:
>>> Robert Haas wrote:
>>>> I haven't yet been convinced we need or want to relax the rule about
>>>> the directory being empty.
>>>
>>> Uh, how would pg_upgrade work then?  It would require renaming the
>>> top-level tablespace directory, which might require root permissions.
>
>> Huh?  Whether or not we choose to store our data files in a
>> subdirectory is an independent question from whether or not we verify
>> that the directory is empty before we start scribbling on it.
>
> No, you're missing the point.  If a pre-9.0 DB is told that tablespace T
> has location '/foo/bar', it'll start creating stuff right in /foo/bar.
> pg_upgrade will tell 9.0 to create the tablespace with location /foo/bar
> as well.  If 9.0 refuses because that directory contains stuff already,
> the upgrade will fail.  Instead, we make a version-numbered subdirectory
> and start creating 9.0's stuff there.
>
> Given the use of the version-numbered subdirectory, I see no real merit
> in insisting that the parent directory be empty anyway.  It'd be
> precisely analogous to "initdb -D /foo/bar/data" insisting that /foo/bar
> be empty, which we have never done and nobody's ever suggested would be
> a good idea.

There aren't a lot of sane use cases for storing other bits of data
inside either $PGDATA or one of your tablespace directories.
However...  I guess you might have something like an empty lost+found
directory if you're creating the tablespace directly on top of a mount
point, and perhaps there's a good argument that that shouldn't
interfere.  Or, I think I've run across NAS devices where every
directory on the system contains a subdirectory called .snapshot, or
something like that.  So maybe insisting on empty isn't right after
all.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Jeff Davis
Дата:
Сообщение: Re: Floating-point timestamps versus Range Types
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Creation of temporary tables on read-only standby servers