From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Centralize setup of SIGQUIT handling for postmaster child proces
Date: Wed, 16 Sep 2020 20:04:43 +0000
Message-ID: <E1kIdfX-0007BL-Eo@gemulon.postgresql.org> (raw)
Centralize setup of SIGQUIT handling for postmaster child processes.
We decided that the policy established in commit 7634bd4f6 for
the bgwriter, checkpointer, walwriter, and walreceiver processes,
namely that they should accept SIGQUIT at all times, really ought
to apply uniformly to all postmaster children. Therefore, get
rid of the duplicative and inconsistent per-process code for
establishing that signal handler and removing SIGQUIT from BlockSig.
Instead, make InitPostmasterChild do it.
The handler set up by InitPostmasterChild is SignalHandlerForCrashExit,
which just summarily does _exit(2). In interactive backends, we
almost immediately replace that with quickdie, since we would prefer
to try to tell the client that we're dying. However, this patch is
changing the behavior of autovacuum (both launcher and workers), as
well as walsenders. Those processes formerly also used quickdie,
but AFAICS that was just mindless copy-and-paste: they don't have
any interactive client that's likely to benefit from being told this.
The stats collector continues to be an outlier, in that it thinks
SIGQUIT means normal exit. That should probably be changed for
consistency, but there's another patch set where that's being
dealt with, so I didn't do so here.
Discussion: https://postgr.es/m/644875.1599933441@sss.pgh.pa.us
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/44fc6e259b799f9924de206eeddc1b1fcbcd172f
Modified Files
--------------
src/backend/postmaster/autovacuum.c | 18 ++++++++++--------
src/backend/postmaster/bgworker.c | 2 +-
src/backend/postmaster/bgwriter.c | 6 +-----
src/backend/postmaster/checkpointer.c | 6 +-----
src/backend/postmaster/pgarch.c | 2 +-
src/backend/postmaster/postmaster.c | 8 ++------
src/backend/postmaster/startup.c | 2 +-
src/backend/postmaster/walwriter.c | 6 +-----
src/backend/replication/walreceiver.c | 6 +-----
src/backend/replication/walsender.c | 2 +-
src/backend/tcop/postgres.c | 16 +++++-----------
src/backend/utils/init/miscinit.c | 26 ++++++++++++++++++++++++++
12 files changed, 51 insertions(+), 49 deletions(-)
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Centralize setup of SIGQUIT handling for postmaster child proces
In-Reply-To: <E1kIdfX-0007BL-Eo@gemulon.postgresql.org>
References: <E1kIdfX-0007BL-Eo@gemulon.postgresql.org>
* 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