Doc: Clarify the `inactive_since` field description.
authorAmit Kapila
Mon, 25 Nov 2024 05:28:06 +0000 (10:58 +0530)
committerAmit Kapila
Mon, 25 Nov 2024 05:28:06 +0000 (10:58 +0530)
Updated to specify that it represents the exact time a slot became
inactive, rather than the period of inactivity.

Reported-by: Peter Smith
Author: Bruce Momjian, Nisha Moond
Reviewed-by: Amit Kapila, Peter Smith
Backpatch-through: 17
Discussion: https://postgr.es/m/CAHut+PuvsyA5v8y7rYoY9mkDQzUhwaESM05yCByTMaDoRh30tA@mail.gmail.com

doc/src/sgml/system-views.sgml
src/backend/replication/logical/slotsync.c
src/include/replication/slot.h

index 8c18bea902fba24633de82771e3255123c3e2c5c..a852bdb99a31f513de615a09dfc55aaf5f3f46f3 100644 (file)
@@ -2397,7 +2397,7 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
        active bool
       
       
-       True if this slot is currently actively being used
+       True if this slot is currently being streamed
       
      
 
@@ -2406,9 +2406,8 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
        active_pid int4
       
       
-       The process ID of the session using this slot if the slot
-       is currently actively being used. NULL if
-       inactive.
+       The process ID of the session streaming data for this slot.
+       NULL if inactive.
       
      
 
@@ -2528,15 +2527,18 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
        inactive_since timestamptz
       
       
-        The time since the slot has become inactive.
-        NULL if the slot is currently being used.
+        The time when the slot became inactive. NULL if the
+        slot is currently being streamed.
         Note that for slots on the standby that are being synced from a
         primary server (whose synced field is
-        true), the
-        inactive_since indicates the last
-        synchronization (see
-        )
-        time.
+        true), the inactive_since
+        indicates the time when slot synchronization (see 
+        linkend="logicaldecoding-replication-slots-synchronization"/>)
+        was most recently stopped.  NULL if the slot
+        has always been synchronized. On standby, this is useful for slots
+        that are being synced from a primary server (whose
+        synced field is true)
+        so they know when the slot stopped being synchronized.
       
      
 
index ebfbaebe16cf8193b7d935822b40a535fe26d4d4..73fe3f56af2b3d58fb97fefdb5ba3171127df98e 100644 (file)
@@ -1516,7 +1516,7 @@ update_synced_slots_inactive_since(void)
     * correctly interpret the inactive_since if the standby gets promoted
     * without a restart. We don't want the slots to appear inactive for a
     * long time after promotion if they haven't been synchronized recently.
-    * Whoever acquires the slot i.e.makes the slot active will reset it.
+    * Whoever acquires the slot, i.e., makes the slot active, will reset it.
     */
    if (!StandbyMode)
        return;
index c9675ee87cc9c708a6fd9ed416f81908fc739edf..07561bc4742928a7494719de7ef5638765be5a21 100644 (file)
@@ -202,7 +202,11 @@ typedef struct ReplicationSlot
     */
    XLogRecPtr  last_saved_confirmed_flush;
 
-   /* The time since the slot has become inactive */
+   /*
+    * The time when the slot became inactive. For synced slots on a standby
+    * server, it represents the time when slot synchronization was most
+    * recently stopped.
+    */
    TimestampTz inactive_since;
 } ReplicationSlot;