pg_receivewal and SIGTERM
Christoph Berg <myon@debian.org>
From: Christoph Berg <myon@debian.org>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-08-15T12:45:24Z
Lists: pgsql-hackers
Attachments
- 0001-pg_receivewal-Exit-cleanly-on-SIGTERM.patch (text/x-diff)
There's a smallish backup tool called pg_backupcluster in Debian's postgresql-common which also ships a systemd service that runs pg_receivewal for wal archiving, and supplies a pg_getwal script for reading the files back on restore, including support for .partial files. So far the machinery was using plain files and relied on compressing the WALs from time to time, but now I wanted to compress the files directly from pg_receivewal --compress=5. Unfortunately this broke the regression tests that include a test for the .partial files where pg_receivewal.service is shut down before the segment is full. The problem was that systemd's default KillSignal is SIGTERM, while pg_receivewal flushes the output compression buffers on SIGINT only. 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.) Christoph
Commits
-
Handle SIGTERM in pg_receivewal and pg_recvlogical
- 8b60db774356 16.0 landed
-
doc: Add missing parenthesis to keycombo
- 6cbed0ec791f 16.0 landed
- 207fc7546644 15.0 landed