Re: Better client reporting for "immediate stop" shutdowns

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Magnus Hagander <magnus@hagander.net>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-12-24T18:04:44Z
Lists: pgsql-hackers
Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> writes:
> On Tue, Dec 22, 2020 at 11:02 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> There might be an argument for emitting the "unexpected SIGQUIT"
>> text if we find garbage in sigquit_reason.  Any thoughts about that?

> Although I can't think of any case now, IMHO we can still have a
> default case(we may or may not hit it) in the switch with a message
> something like  "terminating connection due to unexpected SIGQUIT".

I don't really want to add a default case just on speculation.  We
generally prefer to avoid writing a default in a switch that's supposed
to cover all values of an enum type, because without the default most C
compilers will warn you if you omit a value, whereas with the default
they won't.  Admittedly, it's unlikely someone would add a new
QuitSignalReason and forget to update this code, but still it's not
really project style to do it like that.  I don't think there's enough
risk here to go against the style.

Hence, pushed it like that.

			regards, tom lane



Commits

  1. Suppress log spam from multiple reports of SIGQUIT shutdown.

  2. Improve client error messages for immediate-stop situations.