*** a/src/backend/access/transam/xlog.c
--- b/src/backend/access/transam/xlog.c
***************
*** 6611,6622 **** StartupXLOG(void)
  	}
  
  	/*
! 	 * If we launched a WAL receiver, it should be gone by now. It will trump
! 	 * over the startup checkpoint and subsequent records if it's still alive,
! 	 * so be extra sure that it's gone.
  	 */
  	if (WalRcvInProgress())
! 		elog(PANIC, "wal receiver still active");
  
  	/*
  	 * We don't need the latch anymore. It's not strictly necessary to disown
--- 6611,6629 ----
  	}
  
  	/*
! 	 * If we launched a WAL receiver, it should be gone by now except when
! 	 * we've reached the recovery target. Only if we reached the recovery
! 	 * target, a WAL receiver can still be running, so we stop it and wait
! 	 * for it to die. It will trump over the startup checkpoint and
! 	 * subsequent records if it's still alive, so be extra sure that it's gone.
  	 */
  	if (WalRcvInProgress())
! 	{
! 		if (reachedStopPoint)
! 			ShutdownWalRcv();
! 		else
! 			elog(PANIC, "wal receiver still active");
! 	}
  
  	/*
  	 * We don't need the latch anymore. It's not strictly necessary to disown
