Re: Possible race condition in pg_mkdir_p()?

From: Andres Freund <andres(at)anarazel(dot)de>
To: Ning Yu <nyu(at)pivotal(dot)io>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Paul Guo <pguo(at)pivotal(dot)io>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Subject: Re: Possible race condition in pg_mkdir_p()?
Date: 2019-07-31 04:11:44
Message-ID: 20190731041144.gkmfpvgqa2otl3kp@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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?

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2019-07-31 04:19:40 Re: POC: Cleaning up orphaned files using undo logs
Previous Message Amit Kapila 2019-07-31 04:07:23 Re: SegFault on 9.6.14