diff --git a/src/backend/utils/time/snapmgr.c b/src/backend/utils/time/snapmgr.c index 5aebbd1..6c5e76c 100644 --- a/src/backend/utils/time/snapmgr.c +++ b/src/backend/utils/time/snapmgr.c @@ -163,9 +163,17 @@ GetTransactionSnapshot(void) { /* First, create the snapshot in CurrentSnapshotData */ if (IsolationIsSerializable()) + { + if (RecoveryInProgress()) + ereport(ERROR, + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("can not create a serializable snapshot during recovery"))); + CurrentSnapshot = GetSerializableTransactionSnapshot(&CurrentSnapshotData); + } else CurrentSnapshot = GetSnapshotData(&CurrentSnapshotData); + /* Make a saved copy */ CurrentSnapshot = CopySnapshot(CurrentSnapshot); FirstXactSnapshot = CurrentSnapshot; @@ -290,6 +298,10 @@ SetTransactionSnapshot(Snapshot sourcesnap, TransactionId sourcexid) */ if (IsolationUsesXactSnapshot()) { + /* + * Since GetSnapshotData() is called above, it would be redundant to + * check RecoveryInProgress() for a serializable transaction here. + */ if (IsolationIsSerializable()) SetSerializableTransactionSnapshot(CurrentSnapshot, sourcexid); /* Make a saved copy */