Re: pg_receivewal and SIGTERM - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Re: pg_receivewal and SIGTERM
Date
Msg-id CALj2ACW1LTGaBbhF=E0gmavPYsbNmGdpVu+S6vd3U+93mYnUsw@mail.gmail.com
Whole thread Raw
In response to Re: pg_receivewal and SIGTERM  (Christoph Berg <myon@debian.org>)
Responses Re: pg_receivewal and SIGTERM
List pgsql-hackers
On Tue, Aug 16, 2022 at 7:26 PM Christoph Berg <myon@debian.org> wrote:
>
> Re: Bharath Rupireddy
> > Don't we need a similar explanation [1] for pg_recvlogical docs?
> >
> > [1]
> >    <para>
> >     In the absence of fatal errors, <application>pg_receivewal</application>
> > -   will run until terminated by the <systemitem>SIGINT</systemitem> signal
> > -   (<keycombo action="simul"><keycap>Control</keycap><keycap>C</keycap></keycombo>).
> > +   will run until terminated by the <systemitem>SIGINT</systemitem>
> > +   (<keycombo action="simul"><keycap>Control</keycap><keycap>C</keycap></keycombo>)
> > +   or <systemitem>SIGTERM</systemitem> signal.
>
> Coped that from pg_receivewal(1) now.

Thanks.

    <application>pg_receivewal</application> will exit with status 0 when
-   terminated by the <systemitem>SIGINT</systemitem> signal.  (That is the
+   terminated by the <systemitem>SIGINT</systemitem> or
+   <systemitem>SIGTERM</systemitem> signal.  (That is the
    normal way to end it.  Hence it is not an error.)  For fatal errors or
    other signals, the exit status will be nonzero.

Can we specify the reason in the docs why a SIGTERM causes (which
typically would cause a program to end with non-zero exit code)
pg_receivewal and pg_recvlogical exit with zero exit code? Having this
in the commit message would help developers but the documentation will
help users out there.

Thoughts?

[1]
pg_receivewal, pg_recvlogical: Exit cleanly on SIGTERM

In pg_receivewal, compressed output is only flushed on clean exits. The
reason to support SIGTERM here as well is that pg_receivewal might well
be running as a daemon, and systemd's default KillSignal is SIGTERM.

Since pg_recvlogical is also supposed to run as a daemon, teach it about
SIGTERM as well.

-- 
Bharath Rupireddy
RDS Open Source Databases: https://aws.amazon.com/rds/postgresql/



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Add find_in_log() and advance_wal() perl functions to core test framework (?)
Next
From: Robert Haas
Date:
Subject: pg_walinspect: ReadNextXLogRecord's first_record argument