1
/*-------------------------------------------------------------------------
4
* POSTGRES snapshot definition
6
* Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group
7
* Portions Copyright (c) 1994, Regents of the University of California
9
* src/include/utils/snapshot.h
11
*-------------------------------------------------------------------------
16
#include "access/htup.h"
17
#include "storage/buf.h"
20
typedef struct SnapshotData *Snapshot;
22
#define InvalidSnapshot ((Snapshot) NULL)
25
* We use SnapshotData structures to represent both "regular" (MVCC)
26
* snapshots and "special" snapshots that have non-MVCC semantics.
27
* The specific semantics of a snapshot are encoded by the "satisfies"
30
typedef bool (*SnapshotSatisfiesFunc) (HeapTupleHeader tuple,
31
Snapshot snapshot, Buffer buffer);
33
typedef struct SnapshotData
35
SnapshotSatisfiesFunc satisfies; /* tuple test function */
38
* The remaining fields are used only for MVCC snapshots, and are normally
39
* just zeroes in special snapshots. (But xmin and xmax are used
40
* specially by HeapTupleSatisfiesDirty.)
42
* An MVCC snapshot can never see the effects of XIDs >= xmax. It can see
43
* the effects of all older XIDs except those listed in the snapshot. xmin
44
* is stored as an optimization to avoid needing to search the XID arrays
47
TransactionId xmin; /* all XID < xmin are visible to me */
48
TransactionId xmax; /* all XID >= xmax are invisible to me */
49
uint32 xcnt; /* # of xact ids in xip[] */
50
TransactionId *xip; /* array of xact IDs in progress */
51
/* note: all ids in xip[] satisfy xmin <= xip[i] < xmax */
52
int32 subxcnt; /* # of xact ids in subxip[] */
53
TransactionId *subxip; /* array of subxact IDs in progress */
54
bool suboverflowed; /* has the subxip array overflowed? */
55
bool takenDuringRecovery; /* recovery-shaped snapshot? */
58
* note: all ids in subxip[] are >= xmin, but we don't bother filtering
59
* out any that are >= xmax
61
CommandId curcid; /* in my xact, CID < curcid are visible */
62
uint32 active_count; /* refcount on ActiveSnapshot stack */
63
uint32 regd_count; /* refcount on RegisteredSnapshotList */
64
bool copied; /* false if it's a static snapshot */
68
* Result codes for HeapTupleSatisfiesUpdate. This should really be in
69
* tqual.h, but we want to avoid including that file elsewhere.
73
HeapTupleMayBeUpdated,
80
#endif /* SNAPSHOT_H */