On 2025/06/26 15:43, Hayato Kuroda (Fujitsu) wrote:
Dear Fujii-san,

The pg_replication_slots documentation mentions only max_slot_wal_keep_size
as a condition under which the wal_status column can show unreserved or lost.
However, since commit ac0e33136ab, idle_replication_slot_timeout can also
cause this behavior when it is set. This has not been documented yet.
https://www.postgresql.org/docs/devel/view-pg-replication-slots.html

Oh, I feel the doc should be also updated.

Thanks for the review!


So, how about updating the documentation to also mention
idle_replication_slot_timeout as a factor that can cause wal_status to
become unreserved or lost? Patch attached.

One comment:

```
          <para>
           <literal>lost</literal> means that some required WAL files have
           been removed and this slot is no longer usable.
          </para>
```

IIUC, there is a case that status is "lost" but the required WALs have not been
dropped yet if the slot was invalidated due to the timeout. How about removing 
the
first part:

```
<literal>lost</literal> means that this slot is no longer usable.
```

Agreed. Attached is the updated version of the patch.

Regards,

--
Fujii Masao
NTT DATA Japan Corporation
From a730908764b2255fd7ab36441417bddc643d4a5e Mon Sep 17 00:00:00 2001
From: Fujii Masao <fu...@postgresql.org>
Date: Thu, 26 Jun 2025 16:49:59 +0900
Subject: [PATCH v2] doc: Mention idle_replication_slot_timeout in
 pg_replication_slots docs.

The pg_replication_slots documentation previously mentioned only
max_slot_wal_keep_size as a condition under which the wal_status column
can show unreserved or lost. However, since commit ac0e33136ab,
idle_replication_slot_timeout can also cause this behavior when it is set.
This was not documented.

This commit updates the documentation to also mention
idle_replication_slot_timeout as a factor that can cause wal_status
to become unreserved or lost.

Author: Fujii Masao <masao.fu...@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hay...@fujitsu.com>
Reviewed-by: Nisha Moond <nisha.moond...@gmail.com>
Discussion: 
https://postgr.es/m/78b34e84-2195-4f28-a151-5d204a382...@oss.nttdata.com
---
 doc/src/sgml/system-views.sgml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/doc/src/sgml/system-views.sgml b/doc/src/sgml/system-views.sgml
index 986ae1f543d..308e5dabf3b 100644
--- a/doc/src/sgml/system-views.sgml
+++ b/doc/src/sgml/system-views.sgml
@@ -2825,15 +2825,15 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts 
ppx
         </listitem>
         <listitem>
          <para>
-          <literal>lost</literal> means that some required WAL files have
-          been removed and this slot is no longer usable.
+          <literal>lost</literal> means that this slot is no longer usable.
          </para>
         </listitem>
        </itemizedlist>
        The last two states are seen only when
        <xref linkend="guc-max-slot-wal-keep-size"/> is
-       non-negative. If <structfield>restart_lsn</structfield> is NULL, this
-       field is null.
+       non-negative and/or <xref linkend="guc-idle-replication-slot-timeout"/>
+       is greater than zero. If <structfield>restart_lsn</structfield> is NULL,
+       this field is null.
       </para></entry>
      </row>
 
-- 
2.49.0

Reply via email to