1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-26 01:22:12 +03:00

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
This commit is contained in:
Amit Kapila
2024-11-25 11:12:32 +05:30
parent db80507d98
commit d05a387d9d
3 changed files with 19 additions and 13 deletions

View File

@ -2435,7 +2435,7 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
<structfield>active</structfield> <type>bool</type> <structfield>active</structfield> <type>bool</type>
</para> </para>
<para> <para>
True if this slot is currently actively being used True if this slot is currently being streamed
</para></entry> </para></entry>
</row> </row>
@ -2444,9 +2444,8 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
<structfield>active_pid</structfield> <type>int4</type> <structfield>active_pid</structfield> <type>int4</type>
</para> </para>
<para> <para>
The process ID of the session using this slot if the slot The process ID of the session streaming data for this slot.
is currently actively being used. <literal>NULL</literal> if <literal>NULL</literal> if inactive.
inactive.
</para></entry> </para></entry>
</row> </row>
@ -2566,15 +2565,18 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
<structfield>inactive_since</structfield> <type>timestamptz</type> <structfield>inactive_since</structfield> <type>timestamptz</type>
</para> </para>
<para> <para>
The time since the slot has become inactive. The time when the slot became inactive. <literal>NULL</literal> if the
<literal>NULL</literal> if the slot is currently being used. slot is currently being streamed.
Note that for slots on the standby that are being synced from a Note that for slots on the standby that are being synced from a
primary server (whose <structfield>synced</structfield> field is primary server (whose <structfield>synced</structfield> field is
<literal>true</literal>), the <literal>true</literal>), the <structfield>inactive_since</structfield>
<structfield>inactive_since</structfield> indicates the last indicates the time when slot synchronization (see <xref
synchronization (see linkend="logicaldecoding-replication-slots-synchronization"/>)
<xref linkend="logicaldecoding-replication-slots-synchronization"/>) was most recently stopped. <literal>NULL</literal> if the slot
time. has always been synchronized. On standby, this is useful for slots
that are being synced from a primary server (whose
<structfield>synced</structfield> field is <literal>true</literal>)
so they know when the slot stopped being synchronized.
</para></entry> </para></entry>
</row> </row>

View File

@ -1515,7 +1515,7 @@ update_synced_slots_inactive_since(void)
* correctly interpret the inactive_since if the standby gets promoted * correctly interpret the inactive_since if the standby gets promoted
* without a restart. We don't want the slots to appear inactive for a * 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. * 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) if (!StandbyMode)
return; return;

View File

@ -205,7 +205,11 @@ typedef struct ReplicationSlot
*/ */
XLogRecPtr last_saved_confirmed_flush; 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; TimestampTz inactive_since;
} ReplicationSlot; } ReplicationSlot;