PS_NITPICKS_20240830_CODE_V430001.txt

text/plain

Filename: PS_NITPICKS_20240830_CODE_V430001.txt
Type: text/plain
Part: 0
Message: Re: Introduce XID age and inactive timeout based replication slot invalidation
diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c
index 7009350..c96ae53 100644
--- a/src/backend/replication/slot.c
+++ b/src/backend/replication/slot.c
@@ -671,9 +671,10 @@ retry:
 					(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 					 errmsg("can no longer get changes from replication slot \"%s\"",
 							NameStr(s->data.name)),
-					 errdetail("This slot has been invalidated because it was inactive since %s for more than %d seconds specified by \"replication_slot_inactive_timeout\".",
+					 errdetail("The slot became invalid because it was inactive since %s, which is more than %d seconds ago.",
 							   timestamptz_to_str(s->inactive_since),
-							   replication_slot_inactive_timeout)));
+							   replication_slot_inactive_timeout),
+					 errhint("You might need to increase \"%s\".", "replication_slot_inactive_timeout")));
 		}
 	}
 
@@ -1738,9 +1739,9 @@ InvalidatePossiblyObsoleteSlot(ReplicationSlotInvalidationCause cause,
 					 * is disabled or slot is currently being used or the slot
 					 * on standby is currently being synced from the primary.
 					 *
-					 * Note that we don't invalidate synced slots because,
-					 * they are typically considered not active as they don't
-					 * perform logical decoding to produce the changes.
+					 * Note that we don't invalidate synced slots because
+					 * they are typically considered not active, as they don't
+					 * perform logical decoding to produce changes.
 					 */
 					if (replication_slot_inactive_timeout == 0 ||
 						s->inactive_since == 0 ||
@@ -1789,9 +1790,9 @@ InvalidatePossiblyObsoleteSlot(ReplicationSlotInvalidationCause cause,
 		active_pid = s->active_pid;
 
 		/*
-		 * If the slot can be acquired, do so or if the slot is already ours,
-		 * then mark it invalidated.  Otherwise we'll signal the owning
-		 * process, below, and retry.
+		 * If the slot can be acquired, do so and mark it as invalidated.
+		 * If the slot is already ours, mark it as invalidated.
+		 * Otherwise, we'll signal the owning process below and retry.
 		 */
 		if (active_pid == 0 ||
 			(MyReplicationSlot != NULL &&
@@ -1975,7 +1976,7 @@ restart:
 }
 
 /*
- * Flush all replication slots to disk. Also, invalidate slots during
+ * Flush all replication slots to disk. Also, invalidate obsolete slots during
  * non-shutdown checkpoint.
  *
  * It is convenient to flush dirty replication slots at the time of checkpoint.
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index 861692c..73a5824 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -3030,8 +3030,9 @@ struct config_int ConfigureNamesInt[] =
 
 	{
 		{"replication_slot_inactive_timeout", PGC_SIGHUP, REPLICATION_SENDING,
-			gettext_noop("Sets the amount of time to wait before invalidating an "
-						 "inactive replication slot."),
+
+			gettext_noop("Sets the amount of time a replication slot can remain "
+						 "inactive before it will be invalidated."),
 			NULL,
 			GUC_UNIT_S
 		},