Hi,

pg_recvlogical continuously writes to the file specified with the --file option,
which means the output file can grow indefinitely. To manage file size,
some users may want to rotate the output periodically.

While reviewing the source code to find the way to rotate the file, I noticed
that pg_recvlogical reopens the output file when it receives a SIGHUP signal.
This makes file rotation possible: we can rename the current output file and
then send a SIGHUP to pg_recvlogical, which will close the renamed file and
open a new one with the same original name.

This is a useful feature, but it's currently undocumented. So I'd like to
apply the attached patch that adds this information to the documentation.
Thought?

Regards,

--
Fujii Masao
NTT DATA Japan Corporation
From 3d0b0df5d21b570bbda75353c9ba230d0907e253 Mon Sep 17 00:00:00 2001
From: Fujii Masao <fu...@postgresql.org>
Date: Thu, 10 Jul 2025 16:25:12 +0900
Subject: [PATCH v1] doc: Document reopen of output file via SIGHUP in
 pg_recvlogical.

When pg_recvlogical receives a SIGHUP signal, it closes the current
output file and reopens a new one. This is useful since it allows us to
rotate the output file by renaming the current file and sending a SIGHUP.

This behavior was previously undocumented. This commit adds
the missing documentation.
---
 doc/src/sgml/ref/pg_recvlogical.sgml | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/doc/src/sgml/ref/pg_recvlogical.sgml 
b/doc/src/sgml/ref/pg_recvlogical.sgml
index f68182266a9..3c667141495 100644
--- a/doc/src/sgml/ref/pg_recvlogical.sgml
+++ b/doc/src/sgml/ref/pg_recvlogical.sgml
@@ -53,6 +53,16 @@ PostgreSQL documentation
    (<keycombo 
action="simul"><keycap>Control</keycap><keycap>C</keycap></keycombo>)
    or <systemitem>SIGTERM</systemitem> signal.
   </para>
+
+  <para>
+   When <application>pg_recvlogical</application> receives
+   a <systemitem>SIGHUP</systemitem> signal, it closes the current output file
+   and opens a new one using the filename given with
+   the <option>--file</option> option.  This allows us to rotate
+   the output file by first renaming the current file and then sending
+   a <systemitem>SIGHUP</systemitem> signal to
+   <application>pg_recvlogical</application>.
+  </para>
  </refsect1>
 
  <refsect1>
-- 
2.49.0

Reply via email to