pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Michael Paquier <michael@paquier.xyz>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Some code cleanup for pgbench and pg_verifybackup
Date: Tue, 27 Jul 2021 06:36:15 +0200 (CEST)
Message-ID: <alpine.DEB.2.22.394.2107270614430.297424@pseudo> (raw)
In-Reply-To: <YP9LEHjcSng0Yk0R@paquier.xyz>
References: <alpine.DEB.2.22.394.2107260946550.297424@pseudo>
	<202107261935.tad2ojwemn3v@alvherre.pgsql>
	<YP9LEHjcSng0Yk0R@paquier.xyz>


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.

view thread (13+ messages)  latest in thread

Message-ID: <alpine.DEB.2.22.394.2107270614430.297424@pseudo>
Permalink:  ../alpine.DEB.2.22.394.2107270614430.297424@pseudo/
Also on:    postgresql.org/message-id/alpine.DEB.2.22.394.2107270614430.297424@pseudo

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: coelho@cri.ensmp.fr, michael@paquier.xyz, alvherre@alvh.no-ip.org, pgsql-hackers@lists.postgresql.org
  Subject: Re: Some code cleanup for pgbench and pg_verifybackup
  In-Reply-To: <alpine.DEB.2.22.394.2107270614430.297424@pseudo>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox