agora inbox for pgsql-docs@postgresql.org  
help / color / mirror / Atom feed
Document reopen of output file via SIGHUP in pg_recvlogical
5+ messages / 2 participants
[nested] [flat]

* Document reopen of output file via SIGHUP in pg_recvlogical
@ 2025-07-10 07:47 Fujii Masao <masao.fujii@oss.nttdata.com>
  2025-07-18 02:35 ` Re: Document reopen of output file via SIGHUP in pg_recvlogical Shinya Kato <shinya11.kato@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Fujii Masao @ 2025-07-10 07:47 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org

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 <fujii@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



Attachments:

  [text/plain] v1-0001-doc-Document-reopen-of-output-file-via-SIGHUP-in-.patch (1.5K, ../../0977fc4f-1523-4ecd-8a0e-391af4976367@oss.nttdata.com/2-v1-0001-doc-Document-reopen-of-output-file-via-SIGHUP-in-.patch)
  download | inline diff:
From 3d0b0df5d21b570bbda75353c9ba230d0907e253 Mon Sep 17 00:00:00 2001
From: Fujii Masao <fujii@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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Document reopen of output file via SIGHUP in pg_recvlogical
  2025-07-10 07:47 Document reopen of output file via SIGHUP in pg_recvlogical Fujii Masao <masao.fujii@oss.nttdata.com>
@ 2025-07-18 02:35 ` Shinya Kato <shinya11.kato@gmail.com>
  2025-07-18 03:33   ` Re: Document reopen of output file via SIGHUP in pg_recvlogical Fujii Masao <masao.fujii@oss.nttdata.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Shinya Kato @ 2025-07-18 02:35 UTC (permalink / raw)
  To: Fujii Masao <masao.fujii@oss.nttdata.com>; +Cc: pgsql-docs@lists.postgresql.org

On Thu, Jul 10, 2025 at 4:48 PM Fujii Masao <masao.fujii@oss.nttdata.com> wrote:
>
> 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?

Agreed.
I have confirmed the behavior and I think it should be documented.

Your patch looks good, except that you should use "specified by"
instead of "given with" to be consistent with the other documents.

-- 
Best regards,
Shinya Kato
NTT OSS Center





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Document reopen of output file via SIGHUP in pg_recvlogical
  2025-07-10 07:47 Document reopen of output file via SIGHUP in pg_recvlogical Fujii Masao <masao.fujii@oss.nttdata.com>
  2025-07-18 02:35 ` Re: Document reopen of output file via SIGHUP in pg_recvlogical Shinya Kato <shinya11.kato@gmail.com>
@ 2025-07-18 03:33   ` Fujii Masao <masao.fujii@oss.nttdata.com>
  2025-07-18 07:15     ` Re: Document reopen of output file via SIGHUP in pg_recvlogical Shinya Kato <shinya11.kato@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Fujii Masao @ 2025-07-18 03:33 UTC (permalink / raw)
  To: Shinya Kato <shinya11.kato@gmail.com>; +Cc: pgsql-docs@lists.postgresql.org



On 2025/07/18 11:35, Shinya Kato wrote:
> On Thu, Jul 10, 2025 at 4:48 PM Fujii Masao <masao.fujii@oss.nttdata.com> wrote:
>>
>> 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?
> 
> Agreed.
> I have confirmed the behavior and I think it should be documented.
> 
> Your patch looks good, except that you should use "specified by"
> instead of "given with" to be consistent with the other documents.

Thanks for the review! I've updated the patch as suggested.
The revised version is attached.

Unless there are any objections, I will commit and back-patch it to v13.

Regards,

-- 
Fujii Masao
NTT DATA Japan Corporation
From ba30fea45f2f7d08d8fe5ba451b9c658a28f1ee1 Mon Sep 17 00:00:00 2001
From: Fujii Masao <fujii@postgresql.org>
Date: Fri, 18 Jul 2025 12:21:11 +0900
Subject: [PATCH v2] 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.

Back-patch to all supported versions.

Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Shinya Kato <shinya11.kato@gmail.com>
Discussion: https://postgr.es/m/0977fc4f-1523-4ecd-8a0e-391af4976367@oss.nttdata.com
Backpatch-through: 13
---
 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..263ebdeeab4 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 specified by
+   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



Attachments:

  [text/plain] v2-0001-doc-Document-reopen-of-output-file-via-SIGHUP-in-.patch (1.7K, ../../29fd8017-7f4a-4d58-8649-4847c558c8a7@oss.nttdata.com/2-v2-0001-doc-Document-reopen-of-output-file-via-SIGHUP-in-.patch)
  download | inline diff:
From ba30fea45f2f7d08d8fe5ba451b9c658a28f1ee1 Mon Sep 17 00:00:00 2001
From: Fujii Masao <fujii@postgresql.org>
Date: Fri, 18 Jul 2025 12:21:11 +0900
Subject: [PATCH v2] 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.

Back-patch to all supported versions.

Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Shinya Kato <shinya11.kato@gmail.com>
Discussion: https://postgr.es/m/0977fc4f-1523-4ecd-8a0e-391af4976367@oss.nttdata.com
Backpatch-through: 13
---
 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..263ebdeeab4 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 specified by
+   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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Document reopen of output file via SIGHUP in pg_recvlogical
  2025-07-10 07:47 Document reopen of output file via SIGHUP in pg_recvlogical Fujii Masao <masao.fujii@oss.nttdata.com>
  2025-07-18 02:35 ` Re: Document reopen of output file via SIGHUP in pg_recvlogical Shinya Kato <shinya11.kato@gmail.com>
  2025-07-18 03:33   ` Re: Document reopen of output file via SIGHUP in pg_recvlogical Fujii Masao <masao.fujii@oss.nttdata.com>
@ 2025-07-18 07:15     ` Shinya Kato <shinya11.kato@gmail.com>
  2025-07-20 03:09       ` Re: Document reopen of output file via SIGHUP in pg_recvlogical Fujii Masao <masao.fujii@oss.nttdata.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Shinya Kato @ 2025-07-18 07:15 UTC (permalink / raw)
  To: Fujii Masao <masao.fujii@oss.nttdata.com>; +Cc: pgsql-docs@lists.postgresql.org

On Fri, Jul 18, 2025 at 12:33 PM Fujii Masao
<masao.fujii@oss.nttdata.com> wrote:
>
>
>
> On 2025/07/18 11:35, Shinya Kato wrote:
> > On Thu, Jul 10, 2025 at 4:48 PM Fujii Masao <masao.fujii@oss.nttdata.com> wrote:
> >>
> >> 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?
> >
> > Agreed.
> > I have confirmed the behavior and I think it should be documented.
> >
> > Your patch looks good, except that you should use "specified by"
> > instead of "given with" to be consistent with the other documents.
>
> Thanks for the review! I've updated the patch as suggested.
> The revised version is attached.
>
> Unless there are any objections, I will commit and back-patch it to v13.
>
> Regards,
>
> --
> Fujii Masao
> NTT DATA Japan Corporation

Thanks for updating the patch. LGTM.


-- 
Best regards,
Shinya Kato
NTT OSS Center





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Document reopen of output file via SIGHUP in pg_recvlogical
  2025-07-10 07:47 Document reopen of output file via SIGHUP in pg_recvlogical Fujii Masao <masao.fujii@oss.nttdata.com>
  2025-07-18 02:35 ` Re: Document reopen of output file via SIGHUP in pg_recvlogical Shinya Kato <shinya11.kato@gmail.com>
  2025-07-18 03:33   ` Re: Document reopen of output file via SIGHUP in pg_recvlogical Fujii Masao <masao.fujii@oss.nttdata.com>
  2025-07-18 07:15     ` Re: Document reopen of output file via SIGHUP in pg_recvlogical Shinya Kato <shinya11.kato@gmail.com>
@ 2025-07-20 03:09       ` Fujii Masao <masao.fujii@oss.nttdata.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Fujii Masao @ 2025-07-20 03:09 UTC (permalink / raw)
  To: Shinya Kato <shinya11.kato@gmail.com>; +Cc: pgsql-docs@lists.postgresql.org



On 2025/07/18 16:15, Shinya Kato wrote:
> On Fri, Jul 18, 2025 at 12:33 PM Fujii Masao
> <masao.fujii@oss.nttdata.com> wrote:
>>
>>
>>
>> On 2025/07/18 11:35, Shinya Kato wrote:
>>> On Thu, Jul 10, 2025 at 4:48 PM Fujii Masao <masao.fujii@oss.nttdata.com> wrote:
>>>>
>>>> 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?
>>>
>>> Agreed.
>>> I have confirmed the behavior and I think it should be documented.
>>>
>>> Your patch looks good, except that you should use "specified by"
>>> instead of "given with" to be consistent with the other documents.
>>
>> Thanks for the review! I've updated the patch as suggested.
>> The revised version is attached.
>>
>> Unless there are any objections, I will commit and back-patch it to v13.
>>
>> Regards,
>>
>> --
>> Fujii Masao
>> NTT DATA Japan Corporation
> 
> Thanks for updating the patch. LGTM.

I've pushed the patch. Thanks!

Regards,

-- 
Fujii Masao
NTT DATA Japan Corporation






^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2025-07-20 03:09 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-07-10 07:47 Document reopen of output file via SIGHUP in pg_recvlogical Fujii Masao <masao.fujii@oss.nttdata.com>
2025-07-18 02:35 ` Shinya Kato <shinya11.kato@gmail.com>
2025-07-18 03:33   ` Fujii Masao <masao.fujii@oss.nttdata.com>
2025-07-18 07:15     ` Shinya Kato <shinya11.kato@gmail.com>
2025-07-20 03:09       ` Fujii Masao <masao.fujii@oss.nttdata.com>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox