pgsql: Handle SIGTERM in pg_receivewal and pg_recvlogical

From: Daniel Gustafsson <dgustafsson(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Handle SIGTERM in pg_receivewal and pg_recvlogical
Date: 2022-09-14 14:35:40
Message-ID: E1oYTUJ-000JsF-OM@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)debian(dot)org>
Reviewed-by: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>
Discussion: https://postgr.es/m/Yvo/5No5S0c4EFMj(at)msg(dot)df7cb(dot)de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8b60db774356117fab2eb53fb37160fa3e173cdb

Modified Files
--------------
doc/src/sgml/ref/pg_receivewal.sgml | 8 +++++---
doc/src/sgml/ref/pg_recvlogical.sgml | 18 ++++++++++++++++++
src/bin/pg_basebackup/pg_receivewal.c | 11 ++++++-----
src/bin/pg_basebackup/pg_recvlogical.c | 9 +++++----
4 files changed, 34 insertions(+), 12 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2022-09-14 15:06:35 Re: pgsql: Handle SIGTERM in pg_receivewal and pg_recvlogical
Previous Message Alvaro Herrera 2022-09-14 14:18:42 pgsql: Add subxid-overflow "isolation" test