v104-0001_Amit_1.patch.txt

text/plain

Filename: v104-0001_Amit_1.patch.txt
Type: text/plain
Part: 0
Message: Re: Synchronizing slots from primary to standby
diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c
index aa477015bd..1530e7720c 100644
--- a/src/backend/replication/slot.c
+++ b/src/backend/replication/slot.c
@@ -2390,8 +2390,8 @@ validate_standby_slots(char **newval)
 	{
 		/*
 		 * We cannot validate the replication slot if the replication slots'
-		 * data has not been initialized. This is ok as we will validate the
-		 * specified slot when waiting for them to catch up. See
+		 * data has not been initialized. This is ok as we will anyway validate
+		 * the specified slot when waiting for them to catch up. See
 		 * StandbySlotsHaveCaughtup for details.
 		 */
 	}
@@ -2473,8 +2473,7 @@ assign_standby_slot_names(const char *newval, void *extra)
 	char	   *standby_slot_names_cpy = extra;
 
 	/*
-	 * The standby slots may have changed, so we need to recompute the oldest
-	 * LSN.
+	 * The standby slots may have changed, so we must recompute the oldest LSN.
 	 */
 	standby_slot_oldest_flush_lsn = InvalidXLogRecPtr;
 
@@ -2664,6 +2663,7 @@ StandbySlotsHaveCaughtup(XLogRecPtr wait_for_lsn, int elevel)
 	if (caught_up_slot_num != list_length(standby_slot_names_list))
 		return false;
 
+	/* The standby_slot_oldest_flush_lsn must not retreat. */
 	Assert(XLogRecPtrIsInvalid(standby_slot_oldest_flush_lsn) ||
 		   min_restart_lsn >= standby_slot_oldest_flush_lsn);
 
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c
index b71408d533..580f9dabd3 100644
--- a/src/backend/replication/walsender.c
+++ b/src/backend/replication/walsender.c
@@ -1805,10 +1805,10 @@ NeedToWaitForWal(XLogRecPtr target_lsn, XLogRecPtr flushed_lsn,
 
 	/*
 	 * Check if the standby slots have caught up to the flushed position. It
-	 * is good to wait up to flushed position and then let it send the changes
-	 * to logical subscribers one by one which are already covered in flushed
-	 * position without needing to wait on every change for standby
-	 * confirmation.
+	 * is good to wait up to the flushed position and then let the WalSender
+	 * send the changes to logical subscribers one by one which are already
+	 * covered by the flushed position without needing to wait on every change
+	 * for standby confirmation.
 	 */
 	if (NeedToWaitForStandby(target_lsn, flushed_lsn, wait_event))
 		return true;