Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ngM7z-0000uH-Js for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Apr 2022 07:48:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ngM7x-0008Fg-K5 for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Apr 2022 07:48:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ngM7x-0008FT-AX for pgsql-hackers@lists.postgresql.org; Mon, 18 Apr 2022 07:48:53 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ngM7q-0002DT-5Z for pgsql-hackers@postgresql.org; Mon, 18 Apr 2022 07:48:52 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id D61BF3201E15; Mon, 18 Apr 2022 03:48:44 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 18 Apr 2022 03:48:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1650268124; x=1650354524; bh=B0NXDm9zAY bxMIZW+3uJrDgDen5KuHs4D1k7nx4SlWU=; b=PoQ18uZxzXzsfG1oPXOznxnTG5 sFUeDObo9Gn5ymLTuSEuvd7qfjleIO5IEHFvNp0TJADoDjmwwRZ44WXZXj0yLIPp OQBYui3y4JqoNfDjtL4n9b33WNN2aVmdFnEJz3oPV35UWMx2p27goXlVeI2e9Yoi g7CFtBy9YrXY7rwsMXp77Qo19rW3g8SyerByP9O/tBoH0pGIvlWQRYoK6lG88dqR HSPTF0WbPZdPSpN/oJL2Z+sO4guLPvwurY871c0Pn0d8SaVsWwntqH1scSYbPaN3 qlPp5+RrkTw0a94D7Q7Prr9nO037MLGxmk3fxDtofN/NC+XHxE6EEGVMtAmQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1650268124; x= 1650354524; bh=B0NXDm9zAYbxMIZW+3uJrDgDen5KuHs4D1k7nx4SlWU=; b=x CoN2buuj8+NVaz+OIqCVRwun34bD/I3iDsJ8EBMEAMayIebOe1JncAVJmNcqBU3G QLgammKfi88+nCHvFHufm8hN/0bJP7pdXKduDgEXPzoq7Rmej1wi5hORgwY7IaFl AQ7cl6hC/XWt2BwAMwDM7JasT2LQ7gaukm7NLySbgLmxd81m6kVrNQLjCLNCUECK xG+LVU4/TCNPaQ2wsU2y72ji89SIcbIdYRZr4meIJxBcdHimxJs7ohgobpDko79n ffWv1YsvuhastGdOXPZIwDwJU2KIoSMEGb+sh3OTTai0w2SpzANmdoU0aWwoi7Ma FOWtAbS0verj0GeUuZrBg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrvddttddguddulecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enfghrlhcuvffnffculdefhedmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepvdegudeuhfdtueeltedtveej heehieevueeigeelteegleejleeiueeiheegvefhnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 18 Apr 2022 03:48:42 -0400 (EDT) Date: Mon, 18 Apr 2022 16:48:35 +0900 From: Michael Paquier To: Robert Haas Cc: Nathan Bossart , "pgsql-hackers@postgresql.org" Subject: Re: avoid multiple hard links to same WAL file after a crash Message-ID: References: <20220407182954.GA1231544@nathanxps13> <20220408165312.GB1409034@nathanxps13> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="8hotg91fg1rYekFA" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --8hotg91fg1rYekFA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 08, 2022 at 09:00:36PM -0400, Robert Haas wrote: > On Fri, Apr 8, 2022 at 12:53 PM Nathan Bossart = wrote: >> I think there might be another problem. The man page for rename() seems= to >> indicate that overwriting an existing file also introduces a window where >> the old and new path are hard links to the same file. This isn't a prob= lem >> for the WAL files because we should never be overwriting an existing one, >> but I wonder if it's a problem for other code paths. My guess is that m= any >> code paths that overwrite an existing file are first writing changes to a >> temporary file before atomically replacing the original. Those paths are >> likely okay, too, as you can usually just discard any existing temporary >> files. >=20 > I wonder if this is really true. I thought rename() was supposed to be at= omic. Not always. For example, some old versions of MacOS have a non-atomic implementation of rename(), like prairiedog with 10.4. Even 10.5 does not handle atomicity as far as I call. In short, it looks like a bad idea to me to rely on this idea at all. Some FSes have their own way of handling things, as well, but I am not much into this world. Saying that, it would be nice to see durable_rename_excl() gone as it has created quite a bit of pain for us in the past years. -- Michael --8hotg91fg1rYekFA Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmJdF9MACgkQnvQgOdby QH2EyBAAjqC/9KkVf8qK3L4HlnnWWkSwq1Nv+vzFB80Yv+/vCHDZz4riCDkJO4KW Rco60wG2DTt4Eddu2w0OZdCyrEKTXvzzZsDqt5ltC17WJVyxkVNVYj45b649DTEb 52dnBcsp/SSatAKxxEfRE/B1Qln6WcO17vLYQBjutV19PGqwqxFQLhWhrZcV77Pf Uh558YCPXArY72ztukELlTr58PgJAHDvdejdJ3ol4EXEkEK6Mw86Jhg2jd2g3fMm 5Sk69wxwxaa4Kq9V0EOE2EPwZDt30VWaNNJsQdwYKNMpg5jB5lJQUmj+MfzVRVbF u4DfjjLIrVQRdVGO9wCC1iPz48nQWlNHiexmetCDHyTx3NvU0jM2xzr7uf+GkQJc 42mmGulB+T2oZN5Do/ZI8wyymXAtDqSDqNSXxFYmImT4XwC8WTVGeiYgvH+x7nS7 yDxwHf5iFhohEEqLeKStXmBeR0wx8SsZm3z9Qv1JgMBP4cTlL1qGa5v5IXnov0i4 /IZJWwsnHEO1EZWjGO4w7pkFpTiAJOXeyvM8xZ/Py2QRlT7ekDRevsjVYAOj/Rg0 Dljcfa4OmKXLD9r02+ucKllpppwZRrMNlyHMPsebBmscpirqGGA7tm6bC/UZV+h6 +7+fkyaBYc1PYjsPKdi+6vaDIYfzV1xvUynp8bysFbOUU8vCm1w= =UIP5 -----END PGP SIGNATURE----- --8hotg91fg1rYekFA--