]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix checking for recovery state in WaitForLSN()
authorAlexander Korotkov <akorotkov@postgresql.org>
Fri, 7 Nov 2025 21:34:50 +0000 (23:34 +0200)
committerAlexander Korotkov <akorotkov@postgresql.org>
Fri, 7 Nov 2025 21:34:50 +0000 (23:34 +0200)
We only need to do it for WAIT_LSN_TYPE_REPLAY.  WAIT_LSN_TYPE_FLUSH can work
for both primary and follower.

src/backend/access/transam/xlogwait.c

index 6b4c1623e578aa543b095828c33f4b24aa8b32d9..34fa41ed9b2d7b43c135603adc73be4133124fc7 100644 (file)
@@ -347,7 +347,7 @@ WaitForLSN(WaitLSNType lsnType, XLogRecPtr targetLSN, int64 timeout)
                        currentLSN = GetFlushRecPtr(NULL);
 
                /* Check that recovery is still in-progress */
-               if (!RecoveryInProgress())
+               if (lsnType == WAIT_LSN_TYPE_REPLAY && !RecoveryInProgress())
                {
                        /*
                         * Recovery was ended, but check if target LSN was already