Handle SIGTERM in pg_receivewal and pg_recvlogical
authorDaniel Gustafsson <dgustafsson@postgresql.org>
Wed, 14 Sep 2022 14:32:24 +0000 (16:32 +0200)
committerDaniel Gustafsson <dgustafsson@postgresql.org>
Wed, 14 Sep 2022 14:32:24 +0000 (16:32 +0200)
commit8b60db774356117fab2eb53fb37160fa3e173cdb
tree82dbf0fb5344b10ac0adbf105be3f3e1c5fb7b13
parent0e733278e346f19df93843bce9a81c8183df6e1d
Handle SIGTERM in pg_receivewal and pg_recvlogical

In pg_receivewal, compressed output is only flushed on clean exits.  The
reason to support SIGTERM as well as SIGINT (which is currently handled)
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 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.

Author: Christoph Berg <myon@debian.org>
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/Yvo/5No5S0c4EFMj@msg.df7cb.de
doc/src/sgml/ref/pg_receivewal.sgml
doc/src/sgml/ref/pg_recvlogical.sgml
src/bin/pg_basebackup/pg_receivewal.c
src/bin/pg_basebackup/pg_recvlogical.c