diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index ff56c26..13764ee 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -6651,9 +6651,6 @@ StartupXLOG(void)
 				/* Handle interrupt signals of startup process */
 				HandleStartupProcInterrupts();
 
-				/* Allow read-only connections if we're consistent now */
-				CheckRecoveryConsistency();
-
 				/*
 				 * Have we reached our recovery target?
 				 */
@@ -6746,6 +6743,9 @@ StartupXLOG(void)
 					LWLockRelease(ControlFileLock);
 				}
 
+				/* Allow read-only connections if we're consistent now */
+				CheckRecoveryConsistency();
+
 				/*
 				 * Update shared recoveryLastRecPtr after this record has been
 				 * replayed.
