Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fJpj9-0003gU-RU for pgsql-hackers@arkaria.postgresql.org; Sat, 19 May 2018 00:28:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fJpj8-0000hg-Aa for pgsql-hackers@arkaria.postgresql.org; Sat, 19 May 2018 00:28:02 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fJpj7-0000hW-Up for pgsql-hackers@lists.postgresql.org; Sat, 19 May 2018 00:28:02 +0000 Received: from tamriel.snowman.net ([96.255.250.162]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fJpj4-0007oZ-Ir for pgsql-hackers@postgresql.org; Sat, 19 May 2018 00:28:00 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id A63E85F79C; Fri, 18 May 2018 20:27:57 -0400 (EDT) Date: Fri, 18 May 2018 20:27:57 -0400 From: Stephen Frost To: Ashutosh Bapat Cc: Robert Haas , Andres Freund , Craig Ringer , Thomas Munro , Simon Riggs , PostgreSQL Hackers Subject: Re: Postgres, fsync, and OSs (specifically linux) Message-ID: <20180519002757.GU27724@tamriel.snowman.net> References: <20180430021738.2zip3pfovzm6bpjc@alap3.anarazel.de> <20180430160945.5s5qfoqryhtmugxl@alap3.anarazel.de> <20180509225555.rmk3azmgrwfwudw5@alap3.anarazel.de> <20180517164440.szk6vhbdprcm462a@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="/mOTGTYwFs6hsZJl" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --/mOTGTYwFs6hsZJl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * Ashutosh Bapat (ashutosh.bapat@enterprisedb.com) wrote: > On Thu, May 17, 2018 at 11:45 PM, Robert Haas wro= te: > > On Thu, May 17, 2018 at 12:44 PM, Andres Freund wr= ote: > >> Hi, > >> > >> On 2018-05-10 09:50:03 +0800, Craig Ringer wrote: > >>> while ((src =3D (RewriteMappingFile *) hash_seq_search(&seq_sta= tus)) !=3D NULL) > >>> { > >>> if (FileSync(src->vfd, WAIT_EVENT_LOGICAL_REWRITE_SYNC)= !=3D 0) > >>> - ereport(ERROR, > >>> + ereport(PANIC, > >>> (errcode_for_file_access(), > >>> errmsg("could not fsync file \= "%s\": %m", src->path))); > >> > >> To me this (and the other callers) doesn't quite look right. First, I > >> think we should probably be a bit more restrictive about when PANIC > >> out. It seems like we should PANIC on ENOSPC and EIO, but possibly not > >> others. Secondly, I think we should centralize the error handling. It > >> seems likely that we'll acrue some platform specific workarounds, and I > >> don't want to copy that knowledge everywhere. > > > > Maybe something like: > > > > ereport(promote_eio_to_panic(ERROR), ...) >=20 > Well, searching for places where error is reported with level PANIC, > using word PANIC would miss these instances. People will have to > remember to search with promote_eio_to_panic. May be handle the errors > inside FileSync() itself or a wrapper around that. No, that search wouldn't miss those instances- such a search would find promote_eio_to_panic() and then someone would go look up the uses of that function. That hardly seems like a serious issue for folks hacking on PG. I'm not saying that having a wrapper around FileSync() would be bad or having it handle things, but I don't agree with the general notion that we can't have a function which handles the complicated bits about the kind of error because someone grep'ing the source for PANIC might have to do an additional lookup. Thanks! Stephen --/mOTGTYwFs6hsZJl Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJa/2+NAAoJEO1sijiDR2RV9TMQALmxdrBVTWc/JnJ2sbdHc9Q5 tY0fAMuWpCN7a0AfdhM025+hIMota+rW/3aR5AZNHAsriJRd3UBHbSNZncly6UNA rldTiv5lxZY02oTlrnt4283csrtOc7ox5gNmjLlnHPkAUXUTx3z79uaZIAr8Zrn1 PV/TNScrtrhTgGP7Ha/DBR8u6zfmJEN+JTyVm/NFt+vfiKHoYUuSmPuJXHqXrhTp hf6BQoHkS6iGklDY2CfcNIdxJ6MPiH9jRslRfJcYvZkR3CeAT52IsGEp8pM8lZ5x s3QmjXwG/AMU/I7MGxtcnOkh2KuPWVFsVstQPkzjYA9ELwVdbEzxipKrK4l+ofbd vbWxSHgt0HzKzNZaDQQkhLQrMHQvIur2MZYqz6m05Ngbvvj9dGIHEq1eUFIj0gUX /Ntdmjsix7XLu3Bgkmua20qrmGBgLs7dvuupYK2xLIKqMZBSk/yvojEiuAbglSXP ZxknfGaXqvSQAUwMdpBorP2djwC4nPpUSHWxbAJHBk3kH7lhg7cKKRFAq4pzoUo7 l1lWu0BGPS7HtUcPus+w6T+wPSYJEAIWOvzbgxYG1oZtPuxQvfnl91ud8Nl9yWCa fIWmBvqwiV+vsDlU279U69YYrPz/nhjtTzrfVzXsYzXIwGvq5JM2qRNUwMxqalwf DysJSrnZXhfj6IG1/VqY =SAjI -----END PGP SIGNATURE----- --/mOTGTYwFs6hsZJl--