From 8b60db774356117fab2eb53fb37160fa3e173cdb Mon Sep 17 00:00:00 2001 From: Daniel Gustafsson Date: Wed, 14 Sep 2022 16:32:24 +0200 Subject: 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 Reviewed-by: Bharath Rupireddy Reviewed-by: Michael Paquier Discussion: https://postgr.es/m/Yvo/5No5S0c4EFMj@msg.df7cb.de --- doc/src/sgml/ref/pg_receivewal.sgml | 8 +++++--- doc/src/sgml/ref/pg_recvlogical.sgml | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/pg_receivewal.sgml b/doc/src/sgml/ref/pg_receivewal.sgml index 4fe9e1a8742..5f83ba1893b 100644 --- a/doc/src/sgml/ref/pg_receivewal.sgml +++ b/doc/src/sgml/ref/pg_receivewal.sgml @@ -118,8 +118,9 @@ PostgreSQL documentation In the absence of fatal errors, pg_receivewal - will run until terminated by the SIGINT signal - (ControlC). + will run until terminated by the SIGINT + (ControlC) + or SIGTERM signal. @@ -457,7 +458,8 @@ PostgreSQL documentation pg_receivewal will exit with status 0 when - terminated by the SIGINT signal. (That is the + terminated by the SIGINT or + SIGTERM 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. diff --git a/doc/src/sgml/ref/pg_recvlogical.sgml b/doc/src/sgml/ref/pg_recvlogical.sgml index 1a882254095..6d75b6fa4cb 100644 --- a/doc/src/sgml/ref/pg_recvlogical.sgml +++ b/doc/src/sgml/ref/pg_recvlogical.sgml @@ -46,6 +46,13 @@ PostgreSQL documentation a slot without consuming it, use pg_logical_slot_peek_changes. + + + In the absence of fatal errors, pg_recvlogical + will run until terminated by the SIGINT + (ControlC) + or SIGTERM signal. + @@ -407,6 +414,17 @@ PostgreSQL documentation + + Exit Status + + pg_recvlogical will exit with status 0 when + terminated by the SIGINT or + SIGTERM 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. + + + Environment -- cgit v1.2.3