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.94.2) (envelope-from ) id 1qLvG7-000zDk-L9 for pgsql-general@arkaria.postgresql.org; Wed, 19 Jul 2023 00:41:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qLvG4-00F7nA-M5 for pgsql-general@arkaria.postgresql.org; Wed, 19 Jul 2023 00:41:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qLvG3-00F7n1-7l for pgsql-general@lists.postgresql.org; Wed, 19 Jul 2023 00:41:36 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qLvFw-000K73-R1 for pgsql-general@lists.postgresql.org; Wed, 19 Jul 2023 00:41:34 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 8E010320029B; Tue, 18 Jul 2023 20:41:21 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 18 Jul 2023 20:41:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type: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=fm3; t=1689727281; x=1689813681; bh=tR UC3wqf5yXvr7Y/YeJn5/juQ3WtflsDqS5LXQcNXkI=; b=6Kb8GYef6uB6YCj3yu 4qsulTOeXidbcXQUFjQNNsotBdZqskVCRd03nhyM2rxZh9R2VuiUGbcz56GggHAA VV8hRsWL7UAJGo/8xtPnbIapGKo/3uKcNnTJovE4F4V2NOLP77BcEJA1dOrZ2xmP u31xOKRXl+s/slnBDrKM1WOCTG2rMJHDQqQa+3/cxp4XJpNH/eQPEpw3dcWKe63K 88/NL4Ksw2egmY7XjptpXazNSuXlsIOS9tmVtdgGO/KG56a+ROn+kNEgHP0Yl84T HBcotaGLqxWX9y9CBeLy88nPoVmqbO/xDU/vMq6KCSR0bCJRL/09XH/Eb0np0jNQ AZUQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id: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=fm3; t=1689727281; x=1689813681; bh=tRUC3wqf5yXvr 7Y/YeJn5/juQ3WtflsDqS5LXQcNXkI=; b=ufcacc4MfuNlpEtOsX+mnPokYhPc+ aXnFcnSwQyfjgIP85ZKtQjeoNvW3o8MoG0fnpkOUUrAMzhNh2VEBNz/+NQ4tHEoh LIZfrGDQSCTr8q1rdwKuRolKgkD9RxUtx2WJwv8zG1qcEn/OwNjZgG/AO4ZtitW4 +aPV6Q7rkfYOM6oDtwkEZgcYN9BKGx2YmnRIYRUYwC+V6FmtzQ32u98ZRz4XbcPo IQETvgBfenDkN2stzngzOOJPdNY8wAxqQEmVlcYjN8r8nL+jEGqqTntE0tqDnd44 dXx76TAhyxRQCQpxoKe+zBkMJ2GXlBsxkbKEbMZejAdSVNjmrKiWw4fMA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrgeehgdefjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecufghrlhcuvffnffculdejtddmnecujfgurhepfffhvf evuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcurfgrqhhu ihgvrhcuoehmihgthhgrvghlsehprghquhhivghrrdighiiiqeenucggtffrrghtthgvrh hnpeetleeifedufffhhfdtteelgeeggeffhfekueevteeigfduudevudetgfegiedvjeen ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthh grvghlsehprghquhhivghrrdighiii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 18 Jul 2023 20:41:19 -0400 (EDT) Date: Wed, 19 Jul 2023 09:41:14 +0900 From: Michael Paquier To: Pandora Cc: pgsql-general Subject: Re: fsync data directory after DB crash Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="0sr9ldZEH/ailRWQ" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0sr9ldZEH/ailRWQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jul 18, 2023 at 04:50:25PM +0800, Pandora wrote: > I found that starting from version 9.5, PostgreSQL will do fsync on > the entire data directory after DB crash. Here's a question: if I > have FPW = on, why is this step still necessary? Yes, see around the call of SyncDataDirectory() in xlog.c: * - There might be data which we had written, intending to fsync it, but * which we had not actually fsync'd yet. Therefore, a power failure in * the near future might cause earlier unflushed writes to be lost, even * though more recent data written to disk from here on would be * persisted. To avoid that, fsync the entire data directory. -- Michael --0sr9ldZEH/ailRWQ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmS3MSoACgkQnvQgOdby QH3gjw//U7+nE9QZSiu+B8aTsFxcGfwsbA0iptVhtSz9EMzhD59M5BRMhdYYZ4D0 zh+Tmg9BxYRmuFttxdXyYdjjUVUmKAUkAwOv85sMJ0gw5x5UM8hgBYFmJSb0fv+b OCvCRa9PNDu0OYv6XCiexD0PiWRDy2xrUE1wZUuLln35sC8ni/Agm8X5PwPuBN/w il+IWwolaeB3Bur1jftUUeRgLyno38cA+TAl9/a/6QudftZZH5SjRaAMZDznZUWV MhX6RBXjTkIhwfU/mPpRetZkkIPvtIXppD5L3Zc0zzIA3vxWk6r3bCma0UuxmbYs aTL7siy7SOyjSzXxIYrdTIbk4+M/JYt9TPSMDFL1i7E4mGNBVwTOlWAnD20gIFOG JCz03B2zVlpmuURWBkqLKqiFp/M83kQlltYEytwJuVLjnjksrre4QCLpGlrk+MbZ qx1LPeCkwR28Ku0O6V6gPWec8Wh0eWSpDC2JGE21fAKHTgKlEq+brV7TES0yiBo/ NqnNiSFN+R07fe5AKl73Ekwim4mXCfCQdwJRD6/0eJSV1Sye6w91FwyAOcRzYu1K n1fDnnhC2j4HUY8TsZQCqScCt17AOoQOl6XqIgVBCc9/Cusq067AW745vwwaJ+1v O5xs4svEYIqODBIa10nQEXEHijx+MxUCULbwnAJrLQ1sQQB0h/s= =lhCN -----END PGP SIGNATURE----- --0sr9ldZEH/ailRWQ--