From: Daniel Gustafsson <dgustafsson@postgresql.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Handle SIGTERM in pg_receivewal and pg_recvlogical
Date: Wed, 14 Sep 2022 17:21:06 +0200
Message-ID: <10F7C2B0-26D1-43E5-ACC5-2A05B2EF9CD7@postgresql.org> (raw)
In-Reply-To: <2684964.1663167995@sss.pgh.pa.us>
References: <E1oYTUJ-000JsF-OM@gemulon.postgresql.org>
<2684964.1663167995@sss.pgh.pa.us>
> On 14 Sep 2022, at 17:06, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Daniel Gustafsson <dgustafsson@postgresql.org> writes:
>> Since pg_recvlogical is also supposed to run as a daemon, teach it about
>> SIGTERM as well and update the documentation to match. While in there,
>> change pg_receivewal's time_to_stop to be sig_atomic_t like it is in
>> pg_recvlogical.
>
> While looking at this commit, I wondered why both of those programs
> are declaring their signal handlers like
>
> static void
> sigint_handler(int signum)
>
> rather than our standard convention
>
> static void
> pmdie(SIGNAL_ARGS)
Sorry, I had missed that convention.
> Evidently we don't (any longer?) have any platforms where SIGNAL_ARGS
> is non-default, but that still doesn't make this good coding. More
> than once I've grepped for SIGNAL_ARGS to locate signal handlers.
>
> Hmm, looks like same mistake in pg_waldump ...
pg_test_fsync seems to have the same error.
> barring objection,
> I'm going to run around and fix those.
No objections, unless you have better things to do and wan't me to clean up
then I'll take care of it.
> I also notice that port.h has
>
> typedef void (*pqsigfunc) (int signo);
> extern pqsigfunc pqsignal(int signo, pqsigfunc func);
>
> which is a bit inconsistent with the idea that SIGNAL_ARGS
> might be different from that. Shouldn't we declare it as
>
> typedef void (*pqsigfunc) (SIGNAL_ARGS);
Agreed, that makes sense.
--
Daniel Gustafsson https://vmware.com/
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: dgustafsson@postgresql.org, tgl@sss.pgh.pa.us
Subject: Re: pgsql: Handle SIGTERM in pg_receivewal and pg_recvlogical
In-Reply-To: <10F7C2B0-26D1-43E5-ACC5-2A05B2EF9CD7@postgresql.org>
References: <E1oYTUJ-000JsF-OM@gemulon.postgresql.org> <2684964.1663167995@sss.pgh.pa.us> <10F7C2B0-26D1-43E5-ACC5-2A05B2EF9CD7@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