pg_receivewal and SIGTERM

From: Christoph Berg <myon(at)debian(dot)org>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: pg_receivewal and SIGTERM
Date: 2022-08-15 12:45:24
Message-ID: Yvo/5No5S0c4EFMj@msg.df7cb.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
0001-pg_receivewal-Exit-cleanly-on-SIGTERM.patch text/x-diff 2.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Damir Belyalov 2022-08-15 13:23:26 Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)
Previous Message torikoshia 2022-08-15 12:29:10 Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)