mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Change last_inactive_time to inactive_since in pg_replication_slots.
Commit a11f330b55
added last_inactive_time to show the last time the slot
was inactive. But, it tells the last time that a currently-inactive slot
previously *WAS* active. This could be unclear, so we changed the name to
inactive_since.
Reported-by: Robert Haas
Author: Bharath Rupireddy
Reviewed-by: Bertrand Drouvot, Shveta Malik, Amit Kapila
Discussion: https://postgr.es/m/CA+Tgmob_Ta-t2ty8QrKHBGnNLrf4ZYcwhGHGFsuUoFrAEDw4sA@mail.gmail.com
Discussion: https://postgr.es/m/CALj2ACUXS0SfbHzsX8bqo+7CZhocsV52Kiu7OWGb5HVPAmJqnA@mail.gmail.com
This commit is contained in:
@@ -409,7 +409,7 @@ ReplicationSlotCreate(const char *name, bool db_specific,
|
||||
slot->candidate_restart_valid = InvalidXLogRecPtr;
|
||||
slot->candidate_restart_lsn = InvalidXLogRecPtr;
|
||||
slot->last_saved_confirmed_flush = InvalidXLogRecPtr;
|
||||
slot->last_inactive_time = 0;
|
||||
slot->inactive_since = 0;
|
||||
|
||||
/*
|
||||
* Create the slot on disk. We haven't actually marked the slot allocated
|
||||
@@ -623,9 +623,12 @@ retry:
|
||||
if (SlotIsLogical(s))
|
||||
pgstat_acquire_replslot(s);
|
||||
|
||||
/* Reset the last inactive time as the slot is active now. */
|
||||
/*
|
||||
* Reset the time since the slot has become inactive as the slot is active
|
||||
* now.
|
||||
*/
|
||||
SpinLockAcquire(&s->mutex);
|
||||
s->last_inactive_time = 0;
|
||||
s->inactive_since = 0;
|
||||
SpinLockRelease(&s->mutex);
|
||||
|
||||
if (am_walsender)
|
||||
@@ -703,14 +706,14 @@ ReplicationSlotRelease(void)
|
||||
*/
|
||||
SpinLockAcquire(&slot->mutex);
|
||||
slot->active_pid = 0;
|
||||
slot->last_inactive_time = now;
|
||||
slot->inactive_since = now;
|
||||
SpinLockRelease(&slot->mutex);
|
||||
ConditionVariableBroadcast(&slot->active_cv);
|
||||
}
|
||||
else
|
||||
{
|
||||
SpinLockAcquire(&slot->mutex);
|
||||
slot->last_inactive_time = now;
|
||||
slot->inactive_since = now;
|
||||
SpinLockRelease(&slot->mutex);
|
||||
}
|
||||
|
||||
@@ -2373,9 +2376,9 @@ RestoreSlotFromDisk(const char *name)
|
||||
* inactive as decoding is not allowed on those.
|
||||
*/
|
||||
if (!(RecoveryInProgress() && slot->data.synced))
|
||||
slot->last_inactive_time = GetCurrentTimestamp();
|
||||
slot->inactive_since = GetCurrentTimestamp();
|
||||
else
|
||||
slot->last_inactive_time = 0;
|
||||
slot->inactive_since = 0;
|
||||
|
||||
restored = true;
|
||||
break;
|
||||
|
@@ -410,8 +410,8 @@ pg_get_replication_slots(PG_FUNCTION_ARGS)
|
||||
|
||||
values[i++] = BoolGetDatum(slot_contents.data.two_phase);
|
||||
|
||||
if (slot_contents.last_inactive_time > 0)
|
||||
values[i++] = TimestampTzGetDatum(slot_contents.last_inactive_time);
|
||||
if (slot_contents.inactive_since > 0)
|
||||
values[i++] = TimestampTzGetDatum(slot_contents.inactive_since);
|
||||
else
|
||||
nulls[i++] = true;
|
||||
|
||||
|
Reference in New Issue
Block a user