Re: pg_receivewal and SIGTERM - Mailing list pgsql-hackers

From Daniel Gustafsson
Subject Re: pg_receivewal and SIGTERM
Date
Msg-id EC39E60E-C8B6-4CDF-8BFA-E4D140446B41@yesql.se
Whole thread Raw
In response to pg_receivewal and SIGTERM  (Christoph Berg <myon@debian.org>)
Responses Re: pg_receivewal and SIGTERM
List pgsql-hackers
> On 15 Aug 2022, at 14:45, Christoph Berg <myon@debian.org> wrote:

> The problem was that systemd's default KillSignal is SIGTERM, while
> pg_receivewal flushes the output compression buffers on SIGINT only.

Supporting SIGTERM here makes sense, especially given how systemd works.

> The attached patch makes it do the same for SIGTERM as well. (Most
> places in PG that install a SIGINT handler also install a SIGTERM
> handler already.)

Not really when it comes to utilities though; initdb, pg_dump and pg_test_fsync
seems to be the ones doing so.  (That's probably mostly due to them not running
in a daemon-like way as what's discussed here.)

Do you think pg_recvlogical should support SIGTERM as well?  (The signals which
it does trap should be added to the documentation which just now says "until
terminated by a signal" but that's a separate thing.)

     pqsignal(SIGINT, sigint_handler);
+    pqsignal(SIGTERM, sigint_handler);
Tiny nitpick, I think we should rename sigint_handler to just sig_handler as it
does handle more than sigint.

In relation to this.  Reading over this and looking around I realized that the
documentation for pg_waldump lacks a closing parenthesis on Ctrl+C so I will be
pushing the below to fix it:

--- a/doc/src/sgml/ref/pg_waldump.sgml
+++ b/doc/src/sgml/ref/pg_waldump.sgml
@@ -263,7 +263,7 @@ PostgreSQL documentation
        <para>
         If <application>pg_waldump</application> is terminated by signal
         <systemitem>SIGINT</systemitem>
-        (<keycombo action="simul"><keycap>Control</keycap><keycap>C</keycap></keycombo>,
+        (<keycombo action="simul"><keycap>Control</keycap><keycap>C</keycap></keycombo>),
         the summary of the statistics computed is displayed up to the
         termination point. This operation is not supported on
         <productname>Windows</productname>.

--
Daniel Gustafsson        https://vmware.com/




pgsql-hackers by date:

Previous
From: Bharath Rupireddy
Date:
Subject: Re: Patch proposal: New hooks in the connection path
Next
From: John Naylor
Date:
Subject: Re: build remaining Flex files standalone