PS_NITPICKS_20240917_SLOT_TIMEOUT_v46.txt
text/plain
Filename: PS_NITPICKS_20240917_SLOT_TIMEOUT_v46.txt
Type: text/plain
Part: 0
diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c
index 851120e..0076e4b 100644
--- a/src/backend/replication/slot.c
+++ b/src/backend/replication/slot.c
@@ -1716,15 +1716,12 @@ InvalidatePossiblyObsoleteSlot(ReplicationSlotInvalidationCause cause,
invalidation_cause = cause;
break;
case RS_INVAL_INACTIVE_TIMEOUT:
-
- if (!SlotInactiveTimeoutCheckAllowed(s))
- break;
-
/*
* Check if the slot needs to be invalidated due to
* replication_slot_inactive_timeout GUC.
*/
- if (TimestampDifferenceExceeds(s->inactive_since, now,
+ if (SlotInactiveTimeoutCheckAllowed(s) &&
+ TimestampDifferenceExceeds(s->inactive_since, now,
replication_slot_inactive_timeout * 1000))
{
invalidation_cause = cause;
@@ -1894,7 +1891,7 @@ InvalidatePossiblyObsoleteSlot(ReplicationSlotInvalidationCause cause,
* - RS_INVAL_HORIZON: requires a snapshot <= the given horizon in the given
* db; dboid may be InvalidOid for shared relations
* - RS_INVAL_WAL_LEVEL: is logical
- * - RS_INVAL_INACTIVE_TIMEOUT: inactive timeout occurs
+ * - RS_INVAL_INACTIVE_TIMEOUT: inactive slot timeout has occurred
*
* NB - this runs as part of checkpoint, so avoid raising errors if possible.
*/
diff --git a/src/test/recovery/t/050_invalidate_slots.pl b/src/test/recovery/t/050_invalidate_slots.pl
index c53b5b3..e2fdd52 100644
--- a/src/test/recovery/t/050_invalidate_slots.pl
+++ b/src/test/recovery/t/050_invalidate_slots.pl
@@ -87,7 +87,7 @@ is( $standby1->safe_psql(
'logical slot sync_slot1 is synced to standby');
# Give enough time
-sleep($inactive_timeout+1);
+sleep($inactive_timeout + 1);
# Despite inactive timeout being set, the synced slot won't get invalidated on
# its own on the standby. So, we must not see invalidation message in server