Re: Possible race condition in pg_mkdir_p()?

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Possible race condition in pg_mkdir_p()?
Дата
Msg-id 20190730080434.GA1644@paquier.xyz
обсуждение исходный текст
Ответ на Re: Possible race condition in pg_mkdir_p()?  (Ning Yu <nyu@pivotal.io>)
Ответы Re: Possible race condition in pg_mkdir_p()?  (Ning Yu <nyu@pivotal.io>)
Список pgsql-hackers
On Tue, Jul 23, 2019 at 02:54:20PM +0800, Ning Yu wrote:
> MakePGDirectory() is also called in TablespaceCreateDbspace(), EEXIST is
> considered as non-error for parent directories, however as it considers
> EEXIST as a failure for the last level of the path so the logic is
> still correct,

So the complains here are about two things:
- In some code paths calling mkdir, we don't care about the fact that
EEXIST can happen for something else than a folder.  This could be a
problem if we have conflicts in the backend related to the naming of
the files/folders created.  I find a bit surprising to not perform
the sanity checks in MakePGDirectory() in your patch.  What of all the
existing callers of this routine?
- pg_mkdir_p is pretty bad at detecting problems with concurrent
creation of parent directories, leading to random failures where these
should not happen.

I may be missing something, but your patch does not actually fix
problem 2, no?  Trying to do an initdb with a set of N folders using
the same parent folders not created still results in random failures.
--
Michael

Вложения

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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: POC: Cleaning up orphaned files using undo logs
Следующее
От: Dilip Kumar
Дата:
Сообщение: Re: POC: Cleaning up orphaned files using undo logs