Re: fix pg_mkdir_p to tolerate concurrent directory creation

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: fix pg_mkdir_p to tolerate concurrent directory creation
Date: 2026-06-19 15:40:52
Message-ID: 27f45133-4a6f-45f1-8937-bda963029462@dunslane.net
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2026-06-19 Fr 11:07 AM, Tom Lane wrote:
> Actually ... given this change, why don't we drop the initial stat()
> call? Just try mkdir(), and move on if it succeeds. If not, but
> there's already a directory there, we're good. That eliminates the
> race condition without duplicating code.

LGTM, thanks!

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2026-06-19 15:51:22 Re: Fix \crosstabview to honor \pset display_true/display_false
Previous Message Dmitry Dolgov 2026-06-19 15:11:11 Re: File locks for data directory lockfile in the context of Linux namespaces