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 1nmZNF-00049q-RY for pgsql-hackers@arkaria.postgresql.org; Thu, 05 May 2022 11:10:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nmZNE-0000nb-L1 for pgsql-hackers@arkaria.postgresql.org; Thu, 05 May 2022 11:10:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nmZND-0000nS-7r for pgsql-hackers@lists.postgresql.org; Thu, 05 May 2022 11:10:20 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nmZN5-0002pN-CX for pgsql-hackers@postgresql.org; Thu, 05 May 2022 11:10:18 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id B992B5C01C1; Thu, 5 May 2022 07:10:07 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 05 May 2022 07:10:07 -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=1651749007; x=1651835407; bh=K2cNvtzFor LDJdqgr7f7n25P+XY8njyQ3G+BeXeVtso=; b=SHpnyhC0X+iuLAXE7iIIMd21Ha 6KcQXqIglFuQfRnkBBMdRYTeGB+kjOn5Nhfbn7/nSze2vPjBmTTpe/Wj1iGUWWsX 7/FpktHaojtN48yvboEhxHB2n/CVqDBgJcc+fUbLQTBl9UsmpK0WYhcIaLYlDBdR OWsH89DisquY7QtYkq8cBvH2MEQQL5fmIDvJmEwTBdbtXOEbBWxtZn/5CtBF8jWa PFMH8SjpmirpTfiQ0ptJrrs4S1EhME0rOiRwR8bXowDqrALV3siCrALUqcd7oarf AM4XTnY/0lzcriIlWD6AYQjjTNUHxK38EZ6BOkxrrZJZZNmx4Cfk3NKtZenQ== 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=1651749007; x= 1651835407; bh=K2cNvtzForLDJdqgr7f7n25P+XY8njyQ3G+BeXeVtso=; b=Z nlsAndSahH8oWORMwP8JwJ1VkFiWy6agbaCdavXT8dg/7ZlLXCwcxPuqcMNyt2CR KBTDbgc5jW+gtyMQxSPYfJfCnWG33H8micAevxsywghT7covOaB12UD10H2LDWMz TQTtPCNJGFgXPFC/ZRcTD2tukXmgEH7VtSOHrsIZxJSaBfIVWovRwVBR3TFF/qy9 Hw7lFk3982TvdUhw9OE6eFUJeWKktTY11JGsp03GpuyQClKrpkWkT7g6l9bYDqqj tiugImMsqKPecNy6R9oYu+B3O8/6Ix0A/MVMBWYskX4RQa13Ocio3b3Qe+erLoIw Din5S4wREQZY0t4y8JA2Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfedugdefhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculdejtddmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeetleeifedufffhhfdtteelgeeg geffhfekueevteeigfduudevudetgfegiedvjeenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 5 May 2022 07:10:05 -0400 (EDT) Date: Thu, 5 May 2022 20:10:02 +0900 From: Michael Paquier To: Nathan Bossart Cc: Kyotaro Horiguchi , tgl@sss.pgh.pa.us, robertmhaas@gmail.com, pgsql-hackers@postgresql.org Subject: Re: avoid multiple hard links to same WAL file after a crash Message-ID: References: <289699.1649694527@sss.pgh.pa.us> <20220411165257.GB1915258@nathanxps13> <20220412.154631.417529439388886590.horikyota.ntt@gmail.com> <20220412162742.GB2062175@nathanxps13> <20220502173907.GB3351307@nathanxps13> <20220502230613.GA3398932@nathanxps13> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="alhZUDhsqkFHkfBR" Content-Disposition: inline In-Reply-To: <20220502230613.GA3398932@nathanxps13> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --alhZUDhsqkFHkfBR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, May 02, 2022 at 04:06:13PM -0700, Nathan Bossart wrote: > Here is a new patch set. For now, I've only removed the file existence > check in writeTimeLineHistoryFile(). I don't know if I'm totally convinced > that there isn't a problem here (e.g., due to concurrent .ready file > creation), but since some platforms have been using rename() for some time, > I don't know how worried we should be. That's only about Windows these days, meaning that there is much less coverage in this code path. > I thought about adding some kind of > locking between the WAL receiver and startup processes, but that seems > excessive. Agreed. > Alternatively, we could just fix xlog.c as proposed earlier > [0]. AFAICT that is the only caller that can experience problems due to > the multiple-hard-link issue. All other callers are simply renaming a > temporary file into place, and the temporary file can be discarded if left > behind after a crash. I'd agree with removing all the callers at the end. pgrename() is quite robust on Windows, but I'd keep the two checks in writeTimeLineHistory(), as the logic around findNewestTimeLine() would consider a past TLI history file as in-use even if we have a crash just after the file got created in the same path by the same standby, and the WAL segment init part. Your patch does that. -- Michael --alhZUDhsqkFHkfBR Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmJzsIoACgkQnvQgOdby QH2feA//bamFbSk8zmQQi7DCHF6KQ1CahvBwpdVbPqsMwAsdVzUBPphQfsE9Terz bUMSD4dO4uqwkLjOIgwe2Decvsq+yyJBDkC120g69xHtBsiKcOD1+xg/yMiipYCB dKeDFl6CabbpqZSeLFNBwrcMegnGZ314Cq8MAdobvn0EJhnj+S+0Gk9pkBfuVh62 gWnB5eLiAZhCIG9c40YqvwfnTaFxrdED9ncgV9Ov6tMPEpboTBMuid/7y7f6oeIw lw9A4ozUg8XFJY9kFaaFjeIsjiP1WYIOnKXFSaV9WSKzEpgF7ygyINjywyD2UmaW RgaUw1aKC5/KSRUW8y5lkA8vwfFKO5B+QdhlPKuIoQfMRp6P38mbwDBxj8lOUfdc l5AFmfHGComSlNX02yRCfhWaTBikHC6pt7fjH8NIO8SXanlWVQUa4Ai1ec62grCl kOJshve6hm3PGNh3HPDx5b1TD/KuaQzCMtbGqa3Yd43F9TzhZ51jVQp8VqZjnEvs eq0Xr0de49P7aNq6AW1k6j3nrMs/JaysCK5Q4rYHOPLshIqs6/scXGIpEfhzyfS0 i4QtEiXVhwsbZxd3LIKdqCafY19mnksW9V1caJJfS/70eU9E5r5CHn65A74mcETh /s/9utomrwkenLBOVx5AZ/TzZhuYOUXVTH1dXO3iQddyo1qFYrU= =fWrG -----END PGP SIGNATURE----- --alhZUDhsqkFHkfBR--