diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 619ac8c50c..9c7868a888 100644
*** a/doc/src/sgml/config.sgml
--- b/doc/src/sgml/config.sgml
***************
*** 4206,4212 **** ANY <replaceable class="parameter">num_sync</replaceable> ( <replaceable class="
         </para>
         <para>
          This parameter is intended for use with streaming replication deployments;
!         however, if the parameter is specified it will be honored in all cases.
  
          <varname>hot_standby_feedback</varname> will be delayed by use of this feature
          which could lead to bloat on the master; use both together with care.
--- 4206,4213 ----
         </para>
         <para>
          This parameter is intended for use with streaming replication deployments;
!         however, if the parameter is specified it will be honored in all cases
!         except crash recovery.
  
          <varname>hot_standby_feedback</varname> will be delayed by use of this feature
          which could lead to bloat on the master; use both together with care.
diff --git a/src/backend/accessindex 790e2c8714..8526407ddf 100644
*** a/src/backend/access/transam/xlog.c
--- b/src/backend/access/transam/xlog.c
***************
*** 5977,5982 **** recoveryApplyDelay(XLogReaderState *record)
--- 5977,5986 ----
  	if (!reachedConsistency)
  		return false;
  
+ 	/* nothing to do if crash recovery is requested */
+ 	if (!ArchiveRecoveryRequested && !StandbyModeRequested)
+ 		return false;
+ 
  	/*
  	 * Is it a COMMIT record?
  	 *
***************
*** 6350,6356 **** StartupXLOG(void)
  	 * Take ownership of the wakeup latch if we're going to sleep during
  	 * recovery.
  	 */
! 	if (StandbyModeRequested)
  		OwnLatch(&XLogCtl->recoveryWakeupLatch);
  
  	/* Set up XLOG reader facility */
--- 6354,6360 ----
  	 * Take ownership of the wakeup latch if we're going to sleep during
  	 * recovery.
  	 */
! 	if (ArchiveRecoveryRequested || StandbyModeRequested)
  		OwnLatch(&XLogCtl->recoveryWakeupLatch);
  
  	/* Set up XLOG reader facility */
***************
*** 7334,7340 **** StartupXLOG(void)
  	 * We don't need the latch anymore. It's not strictly necessary to disown
  	 * it, but let's do it for the sake of tidiness.
  	 */
! 	if (StandbyModeRequested)
  		DisownLatch(&XLogCtl->recoveryWakeupLatch);
  
  	/*
--- 7338,7344 ----
  	 * We don't need the latch anymore. It's not strictly necessary to disown
  	 * it, but let's do it for the sake of tidiness.
  	 */
! 	if (ArchiveRecoveryRequested || StandbyModeRequested)
  		DisownLatch(&XLogCtl->recoveryWakeupLatch);
  
  	/*
***************
*** 11869,11874 **** WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
--- 11873,11884 ----
  					 * hope...
  					 */
  
+ 					/*
+ 					 * We should be able to move to XLOG_FROM_STREAM
+ 					 * only in standby mode.
+ 					 */
+ 					Assert(StandbyMode);
+ 
  					/*
  					 * Before we leave XLOG_FROM_STREAM state, make sure that
  					 * walreceiver is not active, so that it won't overwrite
***************
*** 11982,11987 **** WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
--- 11992,12003 ----
  				{
  					bool		havedata;
  
+ 					/*
+ 					 * We should be able to move to XLOG_FROM_STREAM
+ 					 * only in standby mode.
+ 					 */
+ 					Assert(StandbyMode);
+ 
  					/*
  					 * Check if WAL receiver is still active.
  					 */
