diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 50e2b22..593dcee 100644
*** a/src/backend/access/transam/xlog.c
--- b/src/backend/access/transam/xlog.c
*************** recoveryStopsHere(XLogRecord *record, bo
*** 5923,5928 ****
--- 5923,5932 ----
  static void
  recoveryPausesHere(void)
  {
+ 	/* Don't pause unless users can connect! */
+ 	if (!LocalHotStandbyActive)
+ 		return;
+ 
  	ereport(LOG,
  			(errmsg("recovery has paused"),
  			 errhint("Execute pg_xlog_replay_resume() to continue.")));
*************** StartupXLOG(void)
*** 6697,6707 ****
  				 */
  				if (recoveryStopsHere(record, &recoveryApply))
  				{
! 					/*
! 					 * Pause only if users can connect to send a resume
! 					 * message
! 					 */
! 					if (recoveryPauseAtTarget && standbyState == STANDBY_SNAPSHOT_READY)
  					{
  						SetRecoveryPause(true);
  						recoveryPausesHere();
--- 6701,6707 ----
  				 */
  				if (recoveryStopsHere(record, &recoveryApply))
  				{
! 					if (recoveryPauseAtTarget)
  					{
  						SetRecoveryPause(true);
  						recoveryPausesHere();
*************** StartupXLOG(void)
*** 6737,6752 ****
  				/*
  				 * Update shared replayEndRecPtr before replaying this record,
  				 * so that XLogFlush will update minRecoveryPoint correctly.
  				 */
  				SpinLockAcquire(&xlogctl->info_lck);
  				xlogctl->replayEndRecPtr = EndRecPtr;
  				recoveryPause = xlogctl->recoveryPause;
  				SpinLockRelease(&xlogctl->info_lck);
  
! 				/*
! 				 * Pause only if users can connect to send a resume message
! 				 */
! 				if (recoveryPause && standbyState == STANDBY_SNAPSHOT_READY)
  					recoveryPausesHere();
  
  				/*
--- 6737,6751 ----
  				/*
  				 * Update shared replayEndRecPtr before replaying this record,
  				 * so that XLogFlush will update minRecoveryPoint correctly.
+ 				 *
+ 				 * While we have the lock, also check for a pause request.
  				 */
  				SpinLockAcquire(&xlogctl->info_lck);
  				xlogctl->replayEndRecPtr = EndRecPtr;
  				recoveryPause = xlogctl->recoveryPause;
  				SpinLockRelease(&xlogctl->info_lck);
  
! 				if (recoveryPause)
  					recoveryPausesHere();
  
  				/*
