agora inbox for pgsql-docs@postgresql.org  
help / color / mirror / Atom feed
From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: Nisha Moond <nisha.moond412@gmail.com>
Cc: pgsql-docs@lists.postgresql.org
Subject: Re: Mention idle_replication_slot_timeout in pg_replication_slots docs
Date: Wed, 2 Jul 2025 16:12:20 +0900
Message-ID: <95d064d7-9902-436c-a4d2-a1155e4208c2@oss.nttdata.com> (raw)
In-Reply-To: <CABdArM57-zFzXCg8bMYaEdjyVEndssR0qRXU9zA0Fnh5YUaiDg@mail.gmail.com>
References: <78b34e84-2195-4f28-a151-5d204a382fdd@oss.nttdata.com>
	<CABdArM5r8wD8w1dTMh+ozXZw5TbiWRYHzrc2tCy6PNOsffHvLA@mail.gmail.com>
	<938e2d16-4449-413b-a2fc-2595e732e3e1@oss.nttdata.com>
	<CABdArM5qHWK9MTjq9Jj=35UYqv02BjRam0FPCLUHNaMceACpcA@mail.gmail.com>
	<c9d23cdc-b5dd-455a-8ee9-f1f24d701d89@oss.nttdata.com>
	<CABdArM4KqFVoSzZBYs4jPBEo=4e1kjcOpCF8rWZSthxZFcnWdw@mail.gmail.com>
	<8147005b-42b5-47d5-84a4-53965568fd6a@oss.nttdata.com>
	<CABdArM57-zFzXCg8bMYaEdjyVEndssR0qRXU9zA0Fnh5YUaiDg@mail.gmail.com>



On 2025/07/01 13:52, Nisha Moond wrote:
> On Mon, Jun 30, 2025 at 6:12 PM Fujii Masao <masao.fujii@oss.nttdata.com> wrote:
>> Is this true starting from v16, when logical replication from standby was introduced?
>> In other words, in v15 and earlier, only max_slot_wal_keep_size could cause
>> the wal_status to become "unreserved" or "lost"? I'm wondering where to back-patch
>> this fix to.
>>
> 
> I also think we should back-patch this till v16, since that’s when
> additional slot invalidation causes were also introduced(commit
> be87200). And since then “max_slot_wal_keep_size” is no longer the
> sole reason for “unreserved” or “lost” status.

Okay, I've prepared two patches:

- 0001 removes the incorrect line: "If restart_lsn is NULL, this field is null."
   This should be back-patched to v13.
- 0002 updates the description of the wal_status to reflect that max_slot_wal_keep_size
   is not the only cause of the lost state. This should be back-patched to v16.

Barrng objections, I will commit these patches.

Regards,

-- 
Fujii Masao
NTT DATA Japan Corporation
From d8b9c1aace3f21bc916d905380894376bb3c7a6f Mon Sep 17 00:00:00 2001
From: Fujii Masao <fujii@postgresql.org>
Date: Wed, 2 Jul 2025 15:37:53 +0900
Subject: [PATCH v3 1/2] doc: Remove incorrect note about wal_status in
 pg_replication_slots.

The documentation previously stated that the wal_status column is NULL
if restart_lsn is NULL in the pg_replication_slots view. This is incorrect,
and wal_status can be "lost" even when restart_lsn is NULL.

This commit removes the incorrect description.

Back-patched to all supported versions.

Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Nisha Moond <nisha.moond412@gmail.com>
Discussion: https://postgr.es/m/c9d23cdc-b5dd-455a-8ee9-f1f24d701d89@oss.nttdata.com
Backpatch-through: 13
---
 doc/src/sgml/system-views.sgml | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/doc/src/sgml/system-views.sgml b/doc/src/sgml/system-views.sgml
index 986ae1f543d..82825db03bb 100644
--- a/doc/src/sgml/system-views.sgml
+++ b/doc/src/sgml/system-views.sgml
@@ -2832,8 +2832,7 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
        </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.
       </para></entry>
      </row>
 
-- 
2.49.0


From 320e208e4443eb2c89f777ef990f6653628589b4 Mon Sep 17 00:00:00 2001
From: Fujii Masao <fujii@postgresql.org>
Date: Wed, 2 Jul 2025 16:02:29 +0900
Subject: [PATCH v3 2/2] doc: Update outdated descriptions of wal_status in
 pg_replication_slots.

The documentation for pg_replication_slots previously mentioned only
max_slot_wal_keep_size as a condition under which the wal_status column
could show unreserved or lost. However, since commit be87200,
replication slots can also be invalidated due to horizon or wal_level,
and since commit ac0e33136ab, idle_replication_slot_timeout can also
trigger this state.

This commit updates the description of the wal_status column to
reflect that max_slot_wal_keep_size is not the only cause of the lost state.

Back-patched to v16, where the additional invalidation cases were introduced.

Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Nisha Moond <nisha.moond412@gmail.com>
Discussion: https://postgr.es/m/78b34e84-2195-4f28-a151-5d204a382fdd@oss.nttdata.com
Backpatch-through: 17
---
 doc/src/sgml/system-views.sgml | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/doc/src/sgml/system-views.sgml b/doc/src/sgml/system-views.sgml
index 82825db03bb..e1ac544ee40 100644
--- a/doc/src/sgml/system-views.sgml
+++ b/doc/src/sgml/system-views.sgml
@@ -2819,20 +2819,18 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
          <para>
           <literal>unreserved</literal> means that the slot no longer
           retains the required WAL files and some of them are to be removed at
-          the next checkpoint.  This state can return
+          the next checkpoint.  This typically occurs when
+          <xref linkend="guc-max-slot-wal-keep-size"/> is set to
+          a non-negative value.  This state can return
           to <literal>reserved</literal> or <literal>extended</literal>.
          </para>
         </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.
       </para></entry>
      </row>
 
-- 
2.49.0



Attachments:

  [text/plain] v3-0001-doc-Remove-incorrect-note-about-wal_status-in-pg_.patch (1.4K, ../95d064d7-9902-436c-a4d2-a1155e4208c2@oss.nttdata.com/2-v3-0001-doc-Remove-incorrect-note-about-wal_status-in-pg_.patch)
  download | inline diff:
From d8b9c1aace3f21bc916d905380894376bb3c7a6f Mon Sep 17 00:00:00 2001
From: Fujii Masao <fujii@postgresql.org>
Date: Wed, 2 Jul 2025 15:37:53 +0900
Subject: [PATCH v3 1/2] doc: Remove incorrect note about wal_status in
 pg_replication_slots.

The documentation previously stated that the wal_status column is NULL
if restart_lsn is NULL in the pg_replication_slots view. This is incorrect,
and wal_status can be "lost" even when restart_lsn is NULL.

This commit removes the incorrect description.

Back-patched to all supported versions.

Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Nisha Moond <nisha.moond412@gmail.com>
Discussion: https://postgr.es/m/c9d23cdc-b5dd-455a-8ee9-f1f24d701d89@oss.nttdata.com
Backpatch-through: 13
---
 doc/src/sgml/system-views.sgml | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/doc/src/sgml/system-views.sgml b/doc/src/sgml/system-views.sgml
index 986ae1f543d..82825db03bb 100644
--- a/doc/src/sgml/system-views.sgml
+++ b/doc/src/sgml/system-views.sgml
@@ -2832,8 +2832,7 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
        </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.
       </para></entry>
      </row>
 
-- 
2.49.0



  [text/plain] v3-0002-doc-Update-outdated-descriptions-of-wal_status-in.patch (2.4K, ../95d064d7-9902-436c-a4d2-a1155e4208c2@oss.nttdata.com/3-v3-0002-doc-Update-outdated-descriptions-of-wal_status-in.patch)
  download | inline diff:
From 320e208e4443eb2c89f777ef990f6653628589b4 Mon Sep 17 00:00:00 2001
From: Fujii Masao <fujii@postgresql.org>
Date: Wed, 2 Jul 2025 16:02:29 +0900
Subject: [PATCH v3 2/2] doc: Update outdated descriptions of wal_status in
 pg_replication_slots.

The documentation for pg_replication_slots previously mentioned only
max_slot_wal_keep_size as a condition under which the wal_status column
could show unreserved or lost. However, since commit be87200,
replication slots can also be invalidated due to horizon or wal_level,
and since commit ac0e33136ab, idle_replication_slot_timeout can also
trigger this state.

This commit updates the description of the wal_status column to
reflect that max_slot_wal_keep_size is not the only cause of the lost state.

Back-patched to v16, where the additional invalidation cases were introduced.

Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Nisha Moond <nisha.moond412@gmail.com>
Discussion: https://postgr.es/m/78b34e84-2195-4f28-a151-5d204a382fdd@oss.nttdata.com
Backpatch-through: 17
---
 doc/src/sgml/system-views.sgml | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/doc/src/sgml/system-views.sgml b/doc/src/sgml/system-views.sgml
index 82825db03bb..e1ac544ee40 100644
--- a/doc/src/sgml/system-views.sgml
+++ b/doc/src/sgml/system-views.sgml
@@ -2819,20 +2819,18 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
          <para>
           <literal>unreserved</literal> means that the slot no longer
           retains the required WAL files and some of them are to be removed at
-          the next checkpoint.  This state can return
+          the next checkpoint.  This typically occurs when
+          <xref linkend="guc-max-slot-wal-keep-size"/> is set to
+          a non-negative value.  This state can return
           to <literal>reserved</literal> or <literal>extended</literal>.
          </para>
         </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.
       </para></entry>
      </row>
 
-- 
2.49.0



view thread (13+ messages)  latest in thread

Message-ID: <95d064d7-9902-436c-a4d2-a1155e4208c2@oss.nttdata.com>
Permalink:  ../95d064d7-9902-436c-a4d2-a1155e4208c2@oss.nttdata.com/
Also on:    postgresql.org/message-id/95d064d7-9902-436c-a4d2-a1155e4208c2@oss.nttdata.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: masao.fujii@oss.nttdata.com, nisha.moond412@gmail.com, pgsql-docs@lists.postgresql.org
  Subject: Re: Mention idle_replication_slot_timeout in pg_replication_slots docs
  In-Reply-To: <95d064d7-9902-436c-a4d2-a1155e4208c2@oss.nttdata.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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