diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/access/transam.h | 9 | ||||
-rw-r--r-- | src/include/utils/snapshot.h | 7 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/include/access/transam.h b/src/include/access/transam.h index b32044153b0..2f1f144db4d 100644 --- a/src/include/access/transam.h +++ b/src/include/access/transam.h @@ -232,6 +232,15 @@ typedef struct VariableCacheData * committed or aborted */ /* + * Number of top-level transactions with xids (i.e. which may have + * modified the database) that completed in some form since the start of + * the server. This currently is solely used to check whether + * GetSnapshotData() needs to recompute the contents of the snapshot, or + * not. There are likely other users of this. Always above 1. + */ + uint64 xactCompletionCount; + + /* * These fields are protected by XactTruncationLock */ TransactionId oldestClogXid; /* oldest it's safe to look up in clog */ diff --git a/src/include/utils/snapshot.h b/src/include/utils/snapshot.h index 35b1f05bea6..dea072e5edf 100644 --- a/src/include/utils/snapshot.h +++ b/src/include/utils/snapshot.h @@ -207,6 +207,13 @@ typedef struct SnapshotData TimestampTz whenTaken; /* timestamp when snapshot was taken */ XLogRecPtr lsn; /* position in the WAL stream when taken */ + + /* + * The transaction completion count at the time GetSnapshotData() built + * this snapshot. Allows to avoid re-computing static snapshots when no + * transactions completed since the last GetSnapshotData(). + */ + uint64 snapXactCompletionCount; } SnapshotData; #endif /* SNAPSHOT_H */ |