From 7742f99a02ed1679eb6baeb35491ea3cf8a3a36e Mon Sep 17 00:00:00 2001 From: Alexander Korotkov Date: Fri, 7 Nov 2025 23:34:50 +0200 Subject: [PATCH] Fix checking for recovery state in WaitForLSN() 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/access/transam/xlogwait.c b/src/backend/access/transam/xlogwait.c index 6b4c1623e57..34fa41ed9b2 100644 --- a/src/backend/access/transam/xlogwait.c +++ b/src/backend/access/transam/xlogwait.c @@ -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 -- 2.47.3