Hi Nisha,
Here are my review comments for the patch v50-0001.
======
Commit message
1.
In ReplicationSlotAcquire(), raise an error for invalid slots if caller
specify error_if_invalid=true.
/caller/the caller/
/specify/specifies/
======
src/backend/replication/slot.c
ReplicationSlotAcquire:
2.
+ *
+ * An error is raised if error_if_invalid is true and the slot has been
+ * invalidated previously.
*/
void
-ReplicationSlotAcquire(const char *name, bool nowait)
+ReplicationSlotAcquire(const char *name, bool nowait, bool error_if_invalid)
The "has been invalidated previously." sounds a bit tricky. Do you just mean:
"An error is raised if error_if_invalid is true and the slot is found
to be invalid."
~
3.
+ /*
+ * An error is raised if error_if_invalid is true and the slot has been
+ * previously invalidated.
+ */
(ditto previous comment)
~
4.
+ appendStringInfo(&err_detail, _("This slot has been invalidated because "));
+
+ switch (s->data.invalidated)
+ {
+ case RS_INVAL_WAL_REMOVED:
+ appendStringInfo(&err_detail, _("the required WAL has been removed."));
+ break;
+
+ case RS_INVAL_HORIZON:
+ appendStringInfo(&err_detail, _("the required rows have been removed."));
+ break;
+
+ case RS_INVAL_WAL_LEVEL:
+ appendStringInfo(&err_detail, _("wal_level is insufficient for slot."));
+ break;
4a.
I suspect that building the errdetail in 2 parts like this will be
troublesome for the translators of some languages. Probably it is
safer to have the entire errdetail for each case.
~
4b.
By convention, I think the GUC "wal_level" should be double-quoted in
the message.
======
Kind Regards,
Peter Smith.
Fujitsu Australia