*** a/src/backend/storage/ipc/procarray.c
--- b/src/backend/storage/ipc/procarray.c
***************
*** 1074,1081 **** GetSnapshotData(Snapshot snapshot)
  					 errmsg("out of memory")));
  	}
  
- 	snapshot->takenDuringRecovery = RecoveryInProgress();
- 
  	/*
  	 * It is sufficient to get shared lock on ProcArrayLock, even if we are
  	 * going to set MyProc->xmin.
--- 1074,1079 ----
***************
*** 1091,1098 **** GetSnapshotData(Snapshot snapshot)
  	globalxmin = xmin = xmax;
  
  	/*
! 	 * If in recovery get any known assigned xids.
  	 */
  	if (!snapshot->takenDuringRecovery)
  	{
  		/*
--- 1089,1103 ----
  	globalxmin = xmin = xmax;
  
  	/*
! 	 * If we're in recovery then snapshot data comes from a different place,
! 	 * so decide which route we take before grab the lock. It is possible
! 	 * for recovery to end before we finish taking snapshot, and for newly
! 	 * assigned transaction ids to be added to the procarray. Xmax cannot
! 	 * change while we hold ProcArrayLock, so those newly added transaction
! 	 * ids would be filtered away, so we need not be concerned about them.
  	 */
+ 	snapshot->takenDuringRecovery = RecoveryInProgress();
+ 
  	if (!snapshot->takenDuringRecovery)
  	{
  		/*
