diff options
author | Thomas Munro <tmunro@postgresql.org> | 2023-09-05 18:26:12 +1200 |
---|---|---|
committer | Thomas Munro <tmunro@postgresql.org> | 2023-09-05 19:53:43 +1200 |
commit | f691f5b80a85c66d715b4340ffabb503eb19393e (patch) | |
tree | 26a06c87096de2f9571956b4370ccbf1852d4cba /src/include/utils/snapmgr.h | |
parent | aa0d3504560d40f4300a3d49d1c6c3bfc3b894e5 (diff) |
Remove the "snapshot too old" feature.
Remove the old_snapshot_threshold setting and mechanism for producing
the error "snapshot too old", originally added by commit 848ef42b.
Unfortunately it had a number of known problems in terms of correctness
and performance, mostly reported by Andres in the course of his work on
snapshot scalability. We agreed to remove it, after a long period
without an active plan to fix it.
This is certainly a desirable feature, and someone might propose a new
or improved implementation in the future.
Reported-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/CACG%3DezYV%2BEvO135fLRdVn-ZusfVsTY6cH1OZqWtezuEYH6ciQA%40mail.gmail.com
Discussion: https://postgr.es/m/20200401064008.qob7bfnnbu4w5cw4%40alap3.anarazel.de
Discussion: https://postgr.es/m/CA%2BTgmoY%3Daqf0zjTD%2B3dUWYkgMiNDegDLFjo%2B6ze%3DWtpik%2B3XqA%40mail.gmail.com
Diffstat (limited to 'src/include/utils/snapmgr.h')
-rw-r--r-- | src/include/utils/snapmgr.h | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/src/include/utils/snapmgr.h b/src/include/utils/snapmgr.h index 980d37a1947..4dc94e7ec98 100644 --- a/src/include/utils/snapmgr.h +++ b/src/include/utils/snapmgr.h @@ -19,40 +19,6 @@ #include "utils/snapshot.h" -/* - * The structure used to map times to TransactionId values for the "snapshot - * too old" feature must have a few entries at the tail to hold old values; - * otherwise the lookup will often fail and the expected early pruning or - * vacuum will not usually occur. It is best if this padding is for a number - * of minutes greater than a thread would normally be stalled, but it's OK if - * early vacuum opportunities are occasionally missed, so there's no need to - * use an extreme value or get too fancy. 10 minutes seems plenty. - */ -#define OLD_SNAPSHOT_PADDING_ENTRIES 10 -#define OLD_SNAPSHOT_TIME_MAP_ENTRIES (old_snapshot_threshold + OLD_SNAPSHOT_PADDING_ENTRIES) - -/* - * Common definition of relation properties that allow early pruning/vacuuming - * when old_snapshot_threshold >= 0. - */ -#define RelationAllowsEarlyPruning(rel) \ -( \ - RelationIsPermanent(rel) && !IsCatalogRelation(rel) \ - && !RelationIsAccessibleInLogicalDecoding(rel) \ -) - -#define EarlyPruningEnabled(rel) (old_snapshot_threshold >= 0 && RelationAllowsEarlyPruning(rel)) - -/* GUC variables */ -extern PGDLLIMPORT int old_snapshot_threshold; - - -extern Size SnapMgrShmemSize(void); -extern void SnapMgrInit(void); -extern TimestampTz GetSnapshotCurrentTimestamp(void); -extern TimestampTz GetOldSnapshotThresholdTimestamp(void); -extern void SnapshotTooOldMagicForTest(void); - extern PGDLLIMPORT bool FirstSnapshotSet; extern PGDLLIMPORT TransactionId TransactionXmin; @@ -97,14 +63,6 @@ extern PGDLLIMPORT SnapshotData CatalogSnapshotData; ((snapshot)->snapshot_type == SNAPSHOT_MVCC || \ (snapshot)->snapshot_type == SNAPSHOT_HISTORIC_MVCC) -#ifndef FRONTEND -static inline bool -OldSnapshotThresholdActive(void) -{ - return old_snapshot_threshold >= 0; -} -#endif - extern Snapshot GetTransactionSnapshot(void); extern Snapshot GetLatestSnapshot(void); extern void SnapshotSetCommandId(CommandId curcid); @@ -138,13 +96,6 @@ extern void DeleteAllExportedSnapshotFiles(void); extern void WaitForOlderSnapshots(TransactionId limitXmin, bool progress); extern bool ThereAreNoPriorRegisteredSnapshots(void); extern bool HaveRegisteredOrActiveSnapshot(void); -extern bool TransactionIdLimitedForOldSnapshots(TransactionId recentXmin, - Relation relation, - TransactionId *limit_xid, - TimestampTz *limit_ts); -extern void SetOldSnapshotThresholdTimestamp(TimestampTz ts, TransactionId xlimit); -extern void MaintainOldSnapshotTimeMapping(TimestampTz whenTaken, - TransactionId xmin); extern char *ExportSnapshot(Snapshot snapshot); |