On 2025/07/01 13:52, Nisha Moond wrote:
On Mon, Jun 30, 2025 at 6:12 PM Fujii Masao <masao.fu...@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 <fu...@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.fu...@gmail.com>
Reviewed-by: Nisha Moond <nisha.moond...@gmail.com>
Discussion:
https://postgr.es/m/c9d23cdc-b5dd-455a-8ee9-f1f24d701...@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 <fu...@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.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
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