@@ -83,6 +83,7 @@ static SnapshotData SecondarySnapshotData = {SNAPSHOT_MVCC};
83
83
SnapshotData CatalogSnapshotData = {SNAPSHOT_MVCC };
84
84
SnapshotData SnapshotSelfData = {SNAPSHOT_SELF };
85
85
SnapshotData SnapshotAnyData = {SNAPSHOT_ANY };
86
+ SnapshotData SnapshotToastData = {SNAPSHOT_TOAST };
86
87
87
88
/* Pointers to valid snapshots */
88
89
static Snapshot CurrentSnapshot = NULL ;
@@ -119,9 +120,6 @@ typedef struct ActiveSnapshotElt
119
120
/* Top of the stack of active snapshots */
120
121
static ActiveSnapshotElt * ActiveSnapshot = NULL ;
121
122
122
- /* Bottom of the stack of active snapshots */
123
- static ActiveSnapshotElt * OldestActiveSnapshot = NULL ;
124
-
125
123
/*
126
124
* Currently registered Snapshots. Ordered in a heap by xmin, so that we can
127
125
* quickly find the one with lowest xmin, to advance our MyProc->xmin.
@@ -199,8 +197,6 @@ typedef struct SerializedSnapshotData
199
197
bool suboverflowed ;
200
198
bool takenDuringRecovery ;
201
199
CommandId curcid ;
202
- TimestampTz whenTaken ;
203
- XLogRecPtr lsn ;
204
200
}SerializedSnapshotData ;
205
201
206
202
/*
@@ -313,36 +309,6 @@ GetLatestSnapshot(void)
313
309
return SecondarySnapshot ;
314
310
}
315
311
316
- /*
317
- * GetOldestSnapshot
318
- *
319
- *Get the transaction's oldest known snapshot, as judged by the LSN.
320
- *Will return NULL if there are no active or registered snapshots.
321
- */
322
- Snapshot
323
- GetOldestSnapshot (void )
324
- {
325
- Snapshot OldestRegisteredSnapshot = NULL ;
326
- XLogRecPtr RegisteredLSN = InvalidXLogRecPtr ;
327
-
328
- if (!pairingheap_is_empty (& RegisteredSnapshots ))
329
- {
330
- OldestRegisteredSnapshot = pairingheap_container (SnapshotData ,ph_node ,
331
- pairingheap_first (& RegisteredSnapshots ));
332
- RegisteredLSN = OldestRegisteredSnapshot -> lsn ;
333
- }
334
-
335
- if (OldestActiveSnapshot != NULL )
336
- {
337
- XLogRecPtr ActiveLSN = OldestActiveSnapshot -> as_snap -> lsn ;
338
-
339
- if (XLogRecPtrIsInvalid (RegisteredLSN )|| RegisteredLSN > ActiveLSN )
340
- return OldestActiveSnapshot -> as_snap ;
341
- }
342
-
343
- return OldestRegisteredSnapshot ;
344
- }
345
-
346
312
/*
347
313
* GetCatalogSnapshot
348
314
*Get a snapshot that is sufficiently up-to-date for scan of the
@@ -684,8 +650,6 @@ PushActiveSnapshotWithLevel(Snapshot snapshot, int snap_level)
684
650
newactive -> as_snap -> active_count ++ ;
685
651
686
652
ActiveSnapshot = newactive ;
687
- if (OldestActiveSnapshot == NULL )
688
- OldestActiveSnapshot = ActiveSnapshot ;
689
653
}
690
654
691
655
/*
@@ -756,8 +720,6 @@ PopActiveSnapshot(void)
756
720
757
721
pfree (ActiveSnapshot );
758
722
ActiveSnapshot = newstack ;
759
- if (ActiveSnapshot == NULL )
760
- OldestActiveSnapshot = NULL ;
761
723
762
724
SnapshotResetXmin ();
763
725
}
@@ -902,13 +864,6 @@ xmin_cmp(const pairingheap_node *a, const pairingheap_node *b, void *arg)
902
864
* dropped. For efficiency, we only consider recomputing PGPROC->xmin when
903
865
* the active snapshot stack is empty; this allows us not to need to track
904
866
* which active snapshot is oldest.
905
- *
906
- * Note: it's tempting to use GetOldestSnapshot() here so that we can include
907
- * active snapshots in the calculation. However, that compares by LSN not
908
- * xmin so it's not entirely clear that it's the same thing. Also, we'd be
909
- * critically dependent on the assumption that the bottommost active snapshot
910
- * stack entry has the oldest xmin. (Current uses of GetOldestSnapshot() are
911
- * not actually critical, but this would be.)
912
867
*/
913
868
static void
914
869
SnapshotResetXmin (void )
@@ -980,8 +935,6 @@ AtSubAbort_Snapshot(int level)
980
935
pfree (ActiveSnapshot );
981
936
982
937
ActiveSnapshot = next ;
983
- if (ActiveSnapshot == NULL )
984
- OldestActiveSnapshot = NULL ;
985
938
}
986
939
987
940
SnapshotResetXmin ();
@@ -1065,7 +1018,6 @@ AtEOXact_Snapshot(bool isCommit, bool resetXmin)
1065
1018
* it'll go away with TopTransactionContext.
1066
1019
*/
1067
1020
ActiveSnapshot = NULL ;
1068
- OldestActiveSnapshot = NULL ;
1069
1021
pairingheap_reset (& RegisteredSnapshots );
1070
1022
1071
1023
CurrentSnapshot = NULL ;
@@ -1727,8 +1679,6 @@ SerializeSnapshot(Snapshot snapshot, char *start_address)
1727
1679
serialized_snapshot .suboverflowed = snapshot -> suboverflowed ;
1728
1680
serialized_snapshot .takenDuringRecovery = snapshot -> takenDuringRecovery ;
1729
1681
serialized_snapshot .curcid = snapshot -> curcid ;
1730
- serialized_snapshot .whenTaken = snapshot -> whenTaken ;
1731
- serialized_snapshot .lsn = snapshot -> lsn ;
1732
1682
1733
1683
/*
1734
1684
* Ignore the SubXID array if it has overflowed, unless the snapshot was
@@ -1801,8 +1751,6 @@ RestoreSnapshot(char *start_address)
1801
1751
snapshot -> suboverflowed = serialized_snapshot .suboverflowed ;
1802
1752
snapshot -> takenDuringRecovery = serialized_snapshot .takenDuringRecovery ;
1803
1753
snapshot -> curcid = serialized_snapshot .curcid ;
1804
- snapshot -> whenTaken = serialized_snapshot .whenTaken ;
1805
- snapshot -> lsn = serialized_snapshot .lsn ;
1806
1754
snapshot -> snapXactCompletionCount = 0 ;
1807
1755
1808
1756
/* Copy XIDs, if present. */