Re: could not create directory "...": File exists

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: could not create directory "...": File exists
Дата
Msg-id 8980.1358437673@sss.pgh.pa.us
обсуждение исходный текст
Ответ на could not create directory "...": File exists  (Stephen Frost <sfrost@snowman.net>)
Ответы Re: could not create directory "...": File exists  (Stephen Frost <sfrost@snowman.net>)
Список pgsql-hackers
Stephen Frost <sfrost@snowman.net> writes:
>   It turns out that createdb() currently only takes an AccessShareLock
>   on pg_tablespace when scanning it with SnapshotNow, making it possible
>   for a concurrent process to make some uninteresting modification to a
>   tablespace (such as an ACL change) which will cause the heap scan in
>   createdb() to see a given tablespace multiple times.  copydir() will
>   then, rightfully, complain that it's being asked to create a directory
>   which already exists.

Ugh.  Still another problem with non-MVCC catalog scans.

>   Given that this is during createdb(), I'm guessing we don't have any
>   option but to switch the scan to using ShareLock, since there isn't a
>   snapshot available to do an MVCC scan with (I'm guessing that there
>   could be other issues trying to do that anyway).

It seems that the only thing we actually use from each tuple is the OID.
So there are other ways to fix it, of which probably the minimum-change
one is to keep a list of already-processed tablespace OIDs and skip a
tuple if we get a match in the list.  This would be O(N^2) in the number
of tablespaces, but I rather doubt that's a problem.

[ thinks for a bit... ]  Ugh, no, because the *other* risk you've got
here is not seeing a row at all, which would be really bad.

I'm not sure that transiently increasing the lock here is enough,
either.  The concurrent transactions you're worried about probably
aren't holding their locks till commit, so you could get this lock
and still see tuples with unstable committed-good states.
        regards, tom lane



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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Re: Slave enters in recovery and promotes when WAL stream with master is cut + delay master/slave
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Hot Standby conflict resolution handling