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 1m8EpT-0008WH-EN for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Jul 2021 04:36:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m8EpS-0001Ay-8g for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Jul 2021 04:36:30 +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 1m8EpS-0001Ap-0g for pgsql-hackers@lists.postgresql.org; Tue, 27 Jul 2021 04:36:30 +0000 Received: from sfr-1.cri.mines-paristech.fr ([77.158.180.225] helo=smtp.cri.ensmp.fr) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m8EpO-00082y-By for pgsql-hackers@lists.postgresql.org; Tue, 27 Jul 2021 04:36:28 +0000 Received: from GB2AEDM0Q2N9HV2 (pop.92-184-117-74.mobile.abo.orange.fr [92.184.117.74]) by smtp.cri.ensmp.fr (Postfix) with ESMTPSA id 94015C02A9; Tue, 27 Jul 2021 06:38:23 +0200 (CEST) Date: Tue, 27 Jul 2021 06:36:15 +0200 (CEST) From: Fabien COELHO X-X-Sender: fabien@pseudo To: Michael Paquier cc: Alvaro Herrera , Postgres hackers Subject: Re: Some code cleanup for pgbench and pg_verifybackup In-Reply-To: Message-ID: References: <202107261935.tad2ojwemn3v@alvherre.pgsql> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="2056645051-387733313-1627360576=:297424" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --2056645051-387733313-1627360576=:297424 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8BIT Bonjour Michaël-san, >>> The semantics for fatal vs error is that an error is somehow handled while a >>> fatal is not. If the log message is followed by an cold exit, ISTM that >>> fatal is the right call, and I cannot help if other commands do not do that. >>> ISTM more logical to align other commands to fatal when appropriate. > > I disagree. pgbench is an outlier here. There are 71 calls to > pg_log_fatal() in src/bin/, and pgbench counts for 54 of them. It > would be more consistent to align pgbench with the others. I do not understand your disagreement. Do you disagree about the expected semantics of fatal? Then why provide fatal if it should not be used? What is the expected usage of fatal? I do not dispute that pgbench is a statistical outlier. However, Pgbench is somehow special because it does not handle a lot of errors, hence a lot of "fatal & exit" pattern is used, and the user has to restart. There are 76 calls to "exit" from pgbench, but only 23 from psql which is much larger. ISTM that most "normal" pg programs won't do that because they are nice and try to handle errors. So for me "fatal" is the right choice before exiting with a non zero status, but if "error" is called instead I do not think it matters much, you do as you please. >> I was surprised to discover a few weeks ago that pg_log_fatal() did not >> terminate the program, which was my expectation. Mine too. -- Fabien. --2056645051-387733313-1627360576=:297424--