Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1waZn9-001u1h-1U for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Jun 2026 14:01:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1waZn8-00GYiC-17 for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Jun 2026 14:01:54 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1waZn7-00GYi4-1p for pgsql-hackers@lists.postgresql.org; Fri, 19 Jun 2026 14:01:54 +0000 Received: from fout-b2-smtp.messagingengine.com ([202.12.124.145]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1waZn6-000000019JD-0gvl for pgsql-hackers@lists.postgresql.org; Fri, 19 Jun 2026 14:01:52 +0000 Received: from phl-compute-10.internal (phl-compute-10.internal [10.202.2.50]) by mailfout.stl.internal (Postfix) with ESMTP id 26AF71D000EE; Fri, 19 Jun 2026 10:01:50 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-10.internal (MEProxy); Fri, 19 Jun 2026 10:01:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kurilemu.de; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to; s=fm3; t=1781877709; x= 1781964109; bh=xx4LiHYBIy3l2Ule2Ibt6OVGEsb62bwic1tps01SJDs=; b=A VZSri+iyFIciw5IwYwfaC3z0BolypoeY1zWQ/mXGSnmNgKjXoM0VRj1QrdbL0uUa YUXZDe1ID9IyBM6mk1KxFuaprBMY7onxfiFniI4KlijZhcQtNfM5uie5HEekcekX PgTMFSt7Xy4AEWIhsY6FoukW21bRirHw6jLSBTf6ARbsro8mHZfojMhL/AricXRm gwOcqcQBxZBpD7NYhwr0WETv96qjAvRo+5VxRWfu/Znvl0XjyVfMRDwx/UK1NIDz MmQJDStSgxGeJT1c91yaTUpySScvStPUqbatEcTqB1Vw1MjAeZzOwDDjNiyykYWr P+WtGhv8qmVaM8GOYUPig== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1781877709; x=1781964109; bh=x x4LiHYBIy3l2Ule2Ibt6OVGEsb62bwic1tps01SJDs=; b=OkRi6mkvcGg0BBrtu GTlivgaoqVF4Fox4kDFqSh37hkwnuq325buIwntmedKrIbHbvohq4PicBr3Ykb6j DsjNvAeDAbsVbHtTHAZKvU8EbfMVAW3TeIt6V3YLpgBhIMZYMF6TP/xQE3Fav753 y/EgnJQ9NAZBVhmtvh7n4GUA1Qdj0AA272HC1aExqDrmFT8a4sOuJiDu+XjHDdzg jdalnAub68eSgqA6VPcK0yeS/LO3yt3r7aa5g1dd0qNw30xNNjnK+OCfCAujpcgW SgRtnsYmRtAT40GkGb/gAbY1FAqGTbbBRGiI9NP65/pvcGggpuWkmLHtQFKWX9AS vBUeQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTEP660M8X2+xpYZlFxZl7CeqtaYEDkjk9TayKWd0LtoWsuMR4WGNnGQ4f3aq1VLZW E+sMbTNy0kD2HnM0Ad1nTZ0WT2mUYVRpcZcwhthvuU4Sudkv4dZ44TAbmCnoxsqpbK+43Z pe/UFIXnqFhAYBGB9kdIVGl6VuXDCftPi0h7dvunOyqSQDEbXaYMqPrYmRcLWQTJV4cTAX WOMm055d27rHrlsZDxkItlkheh0iKlfrXggoeFfaogfiIyGcPqqEjTBF9fc1fBOqFGPp/B nz4FYndOQG9ibzIM+/RqDdK+TS2tX5vCQI21p9kU65GhaDbmPnJ5HffGh/9c51SHcYaBDw ync5NGvF1Wm4aymFy0nX2cE++1cqBEZmUXEXpFh1UjC6evX4agLiCOM6yW8u+7ZGfElpho BPsM1Vw5wYbs22ElcVFxtJy4qjvkrC9nleLkHFhbYCr2lSuevI85HZouaP67MphWGJiEZB MshdrQrpAjuozNss2dwtELHDHVcfRcq04PWLOrXPP/sxsUlz0WdU5EUclvEanA1rSXHJ8u f9S6UIdvSYhG9lU8UBX3xHYOAW/0Dy5JVUEZDEeyo2k28vIBGLYtA0hY1pp1xME2tg+HyL Rv64vPyXX9gp+tz8w4wEq5bOfas+jcv9O5mGj7u+BiTDjPGf5NP/z5OOOb5Q X-ME-Proxy: Feedback-ID: ie3de48e3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 19 Jun 2026 10:01:49 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kurilemu.de; s=schmee; t=1781877707; bh=925AvBmN+N2y3g2ppSHhMMfuAF679NuYVtoNIMEvZZw=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=s4nFq7UYT4IYa3halirWrGYM8csBLS54MIuvjp4AIliJqgRPPXUWWVxFvASACktrp zMpF1fJHLW7MCq/8TcSWOhXWr+IXkn4lW7KKDvwvp4XIKCpSKT8EA5o/5mp/LIWWuI jDsaQj7dL/ilQtbrQaXl/VzLs7uBYWJItOx6N85PDGkkWdM9AK64+9PrnrELZNWC7O v6X5hLztsfaF31/pN+I5ACwjkr0v5mcroRMhrXNCGiqX998fCMe4C3WUUoNuWt/Q5z GNqOK8mLLSiUTHOTRgsA6T+FciTQstYqCp/3nAXbOJZwOLGWJJrTAsAXuipmpuL1st ZTm5gAsfjMMgw== Received: by ida.kurilemu.internal (Postfix, from userid 1000) id 84043B006B1; Fri, 19 Jun 2026 16:01:47 +0200 (CEST) Date: Fri, 19 Jun 2026 16:01:47 +0200 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: Andrew Dunstan Cc: PostgreSQL Hackers Subject: Re: fix pg_mkdir_p to tolerate concurrent directory creation Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3ca004de-e49b-4471-b8aa-fd656e70f68c@dunslane.net> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2026-Jun-18, Andrew Dunstan wrote: > > While working on the pytest stuff, I found this issue when making it work on > Windows, but the issue can exist everywhere. pg_mkdir_p can fail if there is > a concurrent directory creation. This patch makes it tolerant of concurrent > directory creation. Hmm, should the 'break's in the loop be 'continue's? If you're creating path a/b/c, and a concurrent process beats you but is only attempting to do a/b, then with the break you'll fail to create the final c. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ Bob [Floyd] used to say that he was planning to get a Ph.D. by the "green stamp method," namely by saving envelopes addressed to him as 'Dr. Floyd'. After collecting 500 such letters, he mused, a university somewhere in Arizona would probably grant him a degree. (Don Knuth)