@@ -476,8 +476,9 @@ ProcArrayApplyRecoveryInfo(RunningTransactions running)
476476
477477/*
478478 * If our initial RunningTransactionsData had an overflowed snapshot then
479- * we knew we were missing some subxids from our snapshot. We can use this
480- * data as an initial snapshot, but we cannot yet mark it valid. We know
479+ * we knew we were missing some subxids from our snapshot. If we continue
480+ * to see overflowed snapshots then we might never be able to start up,
481+ * so we make another test to see if our snapshot is now valid. We know
481482 * that the missing subxids are equal to or earlier than nextXid. After we
482483 * initialise we continue to apply changes during recovery, so once the
483484 * oldestRunningXid is later than the nextXid from the initial snapshot we
@@ -486,21 +487,31 @@ ProcArrayApplyRecoveryInfo(RunningTransactions running)
486487 */
487488if (standbyState == STANDBY_SNAPSHOT_PENDING )
488489{
489- if (TransactionIdPrecedes (standbySnapshotPendingXmin ,
490- running -> oldestRunningXid ))
490+ /*
491+ * If the snapshot isn't overflowed or if its empty we can
492+ * reset our pending state and use this snapshot instead.
493+ */
494+ if (!running -> subxid_overflow || running -> xcnt == 0 )
491495{
492- standbyState = STANDBY_SNAPSHOT_READY ;
493- elog (trace_recovery (DEBUG2 ),
494- "running xact data now proven complete" );
495- elog (trace_recovery (DEBUG2 ),
496- "recovery snapshots are now enabled" );
496+ standbyState = STANDBY_INITIALIZED ;
497497}
498498else
499- elog (trace_recovery (DEBUG2 ),
500- "recovery snapshot waiting for %u oldest active xid on standby is %u" ,
501- standbySnapshotPendingXmin ,
502- running -> oldestRunningXid );
503- return ;
499+ {
500+ if (TransactionIdPrecedes (standbySnapshotPendingXmin ,
501+ running -> oldestRunningXid ))
502+ {
503+ standbyState = STANDBY_SNAPSHOT_READY ;
504+ elog (trace_recovery (DEBUG1 ),
505+ "recovery snapshots are now enabled" );
506+ }
507+ else
508+ elog (trace_recovery (DEBUG1 ),
509+ "recovery snapshot waiting for non-overflowed snapshot or "
510+ "until oldest active xid on standby is at least %u (now %u)" ,
511+ standbySnapshotPendingXmin ,
512+ running -> oldestRunningXid );
513+ return ;
514+ }
504515}
505516
506517Assert (standbyState == STANDBY_INITIALIZED );
@@ -605,7 +616,6 @@ ProcArrayApplyRecoveryInfo(RunningTransactions running)
605616standbyState = STANDBY_SNAPSHOT_READY ;
606617
607618standbySnapshotPendingXmin = InvalidTransactionId ;
608- procArray -> lastOverflowedXid = InvalidTransactionId ;
609619}
610620
611621/*
@@ -628,13 +638,15 @@ ProcArrayApplyRecoveryInfo(RunningTransactions running)
628638
629639LWLockRelease (ProcArrayLock );
630640
631- elog (trace_recovery (DEBUG2 ),"running transaction data initialized" );
632641KnownAssignedXidsDisplay (trace_recovery (DEBUG3 ));
633642if (standbyState == STANDBY_SNAPSHOT_READY )
634- elog (trace_recovery (DEBUG2 ),"recovery snapshots are now enabled" );
643+ elog (trace_recovery (DEBUG1 ),"recovery snapshots are now enabled" );
635644else
636- ereport (LOG ,
637- (errmsg ("consistent state delayed because recovery snapshot incomplete" )));
645+ elog (trace_recovery (DEBUG1 ),
646+ "recovery snapshot waiting for non-overflowed snapshot or "
647+ "until oldest active xid on standby is at least %u (now %u)" ,
648+ standbySnapshotPendingXmin ,
649+ running -> oldestRunningXid );
638650}
639651
640652/*