From bc1ebcce98a935c34944bfd5355f04e36e776214 Mon Sep 17 00:00:00 2001
From: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Date: Sat, 21 Oct 2023 00:12:57 +0000
Subject: [PATCH v1] Remove extraneous break condition in logical slot advance
 function

There exists an extraneous break condition in
pg_logical_replication_slot_advance(). When end of WAL or moveto
LSN is reached, the main while condition helps to exit the loop,
so no separate break condition is needed.
---
 src/backend/replication/slotfuncs.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/src/backend/replication/slotfuncs.c b/src/backend/replication/slotfuncs.c
index 6035cf4816..4e5581e7ff 100644
--- a/src/backend/replication/slotfuncs.c
+++ b/src/backend/replication/slotfuncs.c
@@ -523,10 +523,6 @@ pg_logical_replication_slot_advance(XLogRecPtr moveto)
 			if (record)
 				LogicalDecodingProcessRecord(ctx, ctx->reader);
 
-			/* Stop once the requested target has been reached */
-			if (moveto <= ctx->reader->EndRecPtr)
-				break;
-
 			CHECK_FOR_INTERRUPTS();
 		}
 
-- 
2.34.1

