From ce08367751a08148afa9b8f950a1db5732b1db69 Mon Sep 17 00:00:00 2001 From: Shveta Malik Date: Mon, 11 Mar 2024 15:57:17 +0530 Subject: [PATCH v1] Remove redundant RecentFlushPtr fetch in WalSndWaitForWal In WalSndWaitForWal(), we fetch RecentFlushPtr both outside the loop and inside the loop. But we start using RecentFlushPtr only after we fetch it inside the loop. Thus the one outside the loop can be removed. --- src/backend/replication/walsender.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c index 25edb5e141..bc40c454de 100644 --- a/src/backend/replication/walsender.c +++ b/src/backend/replication/walsender.c @@ -1831,12 +1831,6 @@ WalSndWaitForWal(XLogRecPtr loc) !NeedToWaitForWal(loc, RecentFlushPtr, &wait_event)) return RecentFlushPtr; - /* Get a more recent flush pointer. */ - if (!RecoveryInProgress()) - RecentFlushPtr = GetFlushRecPtr(NULL); - else - RecentFlushPtr = GetXLogReplayRecPtr(NULL); - /* * Within the loop, we wait for the necessary WALs to be flushed to disk * first, followed by waiting for standbys to catch up if there are enough -- 2.34.1