postgres.git / summary / log / commit / refs

commit    397cd0b3c7d18c21daea175a8280afea723f4eac
Author:   Amit Kapila <akapila@postgresql.org>
Date:     Tue Mar 12 04:55:27 2024 +0000
First released in: 17.0

    Remove redundant fetch of the recent flush pointer in WalSndWaitForWal.
    
    In WalSndWaitForWal(), we fetch a recent flush pointer both outside the
    loop and inside the loop. But we start using RecentFlushPtr only after we
    fetch it inside the loop. So we can remove one outside the loop.
    
    Author: Shveta Malik
    Reviewed-by: Bertrand Drouvot, Matthias van de Meent, Amit Kapila
    Discussion: https://postgr.es/m/CAJpy0uBSCQz1yMD-WiEthzEe23dti2-Kr_pitVb7vAPFbFKm=A@mail.gmail.com


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 25edb5e1412..bc40c454de4 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 [parent: 2c8118ee5d98]