Hi Nisha. Here are some review comments for patch v51-0002.
======
doc/src/sgml/system-views.sgml
1.
The time when the slot became inactive. <literal>NULL</literal> if the
- slot is currently being streamed.
+ slot is currently being streamed. Once the slot is invalidated, this
+ value will remain unchanged until we shutdown the server.
.
I think "Once the ..." kind of makes it sound like invalidation is
inevitable. Also maybe it's better to remove the "we".
SUGGESTION:
If the slot becomes invalidated, this value will remain unchanged
until server shutdown.
======
src/backend/replication/slot.c
ReplicationSlotAcquire:
2.
GENERAL.
This just is a question/idea. It may not be feasible to change. It
seems like there is a lot of overlap between the error messages in
'ReplicationSlotAcquire' which are saying "This slot has been
invalidated because...", and with the other function
'ReportSlotInvalidation' which is kind of the same but called in
different circumstances and with slightly different message text. I
wondered if there is a way to use common code to unify these messages
instead of having a nearly duplicate set of messages for all the
invalidation causes?
~~~
3.
+ case RS_INVAL_INACTIVE_TIMEOUT:
+ appendStringInfo(&err_detail, _("inactivity exceeded the time limit
set by \"%s\"."),
+ "replication_slot_inactive_timeout");
+ break;
Should this err_detail also say "This slot has been invalidated
because ..." like all the others?
~~~
InvalidatePossiblyObsoleteSlot:
4.
+ case RS_INVAL_INACTIVE_TIMEOUT:
+
+ /*
+ * Check if the slot needs to be invalidated due to
+ * replication_slot_inactive_timeout GUC.
+ */
+ if (IsSlotInactiveTimeoutPossible(s) &&
+ TimestampDifferenceExceeds(s->inactive_since, now,
+ replication_slot_inactive_timeout_sec * 1000))
+ {
Maybe this code should have Assert(now > 0); before the condition just
as a way to 'document' that it is assumed 'now' was already set this
outside the mutex.
======
Kind Regards,
Peter Smith.
Fujitsu Australia