diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index c29913003809dc14772ca0f761956fb5287aef64..3cde91eaf8af49fcfb75dd8a51efb418a5db4cc8 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -6794,11 +6794,6 @@ StartupXLOG(void)
 				 */
 				if (recoveryStopsHere(record, &recoveryApply, &recoveryDelay))
 				{
-					if (recoveryPauseAtTarget)
-					{
-						SetRecoveryPause(true);
-						recoveryPausesHere();
-					}
 					reachedStopPoint = true;	/* see below */
 					recoveryContinue = false;
 
@@ -6948,6 +6943,12 @@ StartupXLOG(void)
 			 * end of main redo apply loop
 			 */
 
+			if (recoveryPauseAtTarget && reachedStopPoint)
+			{
+				SetRecoveryPause(true);
+				recoveryPausesHere();
+			}
+
 			ereport(LOG,
 					(errmsg("redo done at %X/%X",
 						 (uint32) (ReadRecPtr >> 32), (uint32) ReadRecPtr)));