Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d05a387

Browse files
author
Amit Kapila
committed
Doc: Clarify the inactive_since field description.
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
1 parent db80507 commit d05a387

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

doc/src/sgml/system-views.sgml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2435,7 +2435,7 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
24352435
<structfield>active</structfield> <type>bool</type>
24362436
</para>
24372437
<para>
2438-
True if this slot is currently actively being used
2438+
True if this slot is currently being streamed
24392439
</para></entry>
24402440
</row>
24412441

@@ -2444,9 +2444,8 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
24442444
<structfield>active_pid</structfield> <type>int4</type>
24452445
</para>
24462446
<para>
2447-
The process ID of the session using this slot if the slot
2448-
is currently actively being used. <literal>NULL</literal> if
2449-
inactive.
2447+
The process ID of the session streaming data for this slot.
2448+
<literal>NULL</literal> if inactive.
24502449
</para></entry>
24512450
</row>
24522451

@@ -2566,15 +2565,18 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
25662565
<structfield>inactive_since</structfield> <type>timestamptz</type>
25672566
</para>
25682567
<para>
2569-
The time since the slot has become inactive.
2570-
<literal>NULL</literal> if the slot is currently being used.
2568+
The time when the slot became inactive. <literal>NULL</literal> if the
2569+
slot is currently being streamed.
25712570
Note that for slots on the standby that are being synced from a
25722571
primary server (whose <structfield>synced</structfield> field is
2573-
<literal>true</literal>), the
2574-
<structfield>inactive_since</structfield> indicates the last
2575-
synchronization (see
2576-
<xref linkend="logicaldecoding-replication-slots-synchronization"/>)
2577-
time.
2572+
<literal>true</literal>), the <structfield>inactive_since</structfield>
2573+
indicates the time when slot synchronization (see <xref
2574+
linkend="logicaldecoding-replication-slots-synchronization"/>)
2575+
was most recently stopped. <literal>NULL</literal> if the slot
2576+
has always been synchronized. On standby, this is useful for slots
2577+
that are being synced from a primary server (whose
2578+
<structfield>synced</structfield> field is <literal>true</literal>)
2579+
so they know when the slot stopped being synchronized.
25782580
</para></entry>
25792581
</row>
25802582

src/backend/replication/logical/slotsync.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,7 @@ update_synced_slots_inactive_since(void)
15151515
* correctly interpret the inactive_since if the standby gets promoted
15161516
* without a restart. We don't want the slots to appear inactive for a
15171517
* long time after promotion if they haven't been synchronized recently.
1518-
* Whoever acquires the slot i.e.makes the slot active will reset it.
1518+
* Whoever acquires the slot, i.e., makes the slot active, will reset it.
15191519
*/
15201520
if (!StandbyMode)
15211521
return;

src/include/replication/slot.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,11 @@ typedef struct ReplicationSlot
205205
*/
206206
XLogRecPtr last_saved_confirmed_flush;
207207

208-
/* The time since the slot has become inactive */
208+
/*
209+
* The time when the slot became inactive. For synced slots on a standby
210+
* server, it represents the time when slot synchronization was most
211+
* recently stopped.
212+
*/
209213
TimestampTz inactive_since;
210214
} ReplicationSlot;
211215

0 commit comments

Comments
 (0)