Skip to content

Commit 5f46439

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 1a52069 commit 5f46439

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
@@ -2397,7 +2397,7 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
23972397
<structfield>active</structfield> <type>bool</type>
23982398
</para>
23992399
<para>
2400-
True if this slot is currently actively being used
2400+
True if this slot is currently being streamed
24012401
</para></entry>
24022402
</row>
24032403

@@ -2406,9 +2406,8 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
24062406
<structfield>active_pid</structfield> <type>int4</type>
24072407
</para>
24082408
<para>
2409-
The process ID of the session using this slot if the slot
2410-
is currently actively being used. <literal>NULL</literal> if
2411-
inactive.
2409+
The process ID of the session streaming data for this slot.
2410+
<literal>NULL</literal> if inactive.
24122411
</para></entry>
24132412
</row>
24142413

@@ -2528,15 +2527,18 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
25282527
<structfield>inactive_since</structfield> <type>timestamptz</type>
25292528
</para>
25302529
<para>
2531-
The time since the slot has become inactive.
2532-
<literal>NULL</literal> if the slot is currently being used.
2530+
The time when the slot became inactive. <literal>NULL</literal> if the
2531+
slot is currently being streamed.
25332532
Note that for slots on the standby that are being synced from a
25342533
primary server (whose <structfield>synced</structfield> field is
2535-
<literal>true</literal>), the
2536-
<structfield>inactive_since</structfield> indicates the last
2537-
synchronization (see
2538-
<xref linkend="logicaldecoding-replication-slots-synchronization"/>)
2539-
time.
2534+
<literal>true</literal>), the <structfield>inactive_since</structfield>
2535+
indicates the time when slot synchronization (see <xref
2536+
linkend="logicaldecoding-replication-slots-synchronization"/>)
2537+
was most recently stopped. <literal>NULL</literal> if the slot
2538+
has always been synchronized. On standby, this is useful for slots
2539+
that are being synced from a primary server (whose
2540+
<structfield>synced</structfield> field is <literal>true</literal>)
2541+
so they know when the slot stopped being synchronized.
25402542
</para></entry>
25412543
</row>
25422544

src/backend/replication/logical/slotsync.c

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

src/include/replication/slot.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,11 @@ typedef struct ReplicationSlot
202202
*/
203203
XLogRecPtr last_saved_confirmed_flush;
204204

205-
/* The time since the slot has become inactive */
205+
/*
206+
* The time when the slot became inactive. For synced slots on a standby
207+
* server, it represents the time when slot synchronization was most
208+
* recently stopped.
209+
*/
206210
TimestampTz inactive_since;
207211
} ReplicationSlot;
208212

0 commit comments

Comments
 (0)