Re: Possible race condition in pg_mkdir_p()?

Поиск
Список
Период
Сортировка
От Ning Yu
Тема Re: Possible race condition in pg_mkdir_p()?
Дата
Msg-id CAKmaiL2DmssMdEpTyZRShX+-7uTOXhT3910PTr5c0MbhQdRPtA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Possible race condition in pg_mkdir_p()?  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
On Wed, Jul 31, 2019 at 12:11 PM Andres Freund <andres@anarazel.de> wrote:
>
> Hi,
>
> On 2019-07-18 16:17:22 +0800, Ning Yu wrote:
> > This seems buggy as it first checks the existence of the dir and makes the
> > dir if it does not exist yet, however when executing concurrently a
> > possible race condition can be as below:
> >
> > A: does a/ exists? no
> > B: does a/ exists? no
> > A: try to create a/, succeed
> > B: try to create a/, failed as it already exists
>
> Hm. I'm not really seing much of a point in making mkdir_p safe against
> all of this. What's the scenario for pg where this matters? I assume
> you're using it for somewhat different purposes, and that's why it is
> problematic for you?

Yes, you are right, postgres itself might not run into such kind of race
condition issue.  The problem we encountered was on a downstream product
of postgres, where multiple postgres clusters are deployed on the same
machine with common parent dirs.

Best Regards
Ning

>
> Greetings,
>
> Andres Freund



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: SegFault on 9.6.14
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Possible race condition in pg_mkdir_p()?