PostgreSQL Source Code  git master
snapshot.h File Reference
#include "access/htup.h"
#include "access/xlogdefs.h"
#include "datatype/timestamp.h"
#include "lib/pairingheap.h"
#include "storage/buf.h"
Include dependency graph for snapshot.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SnapshotData
 

Macros

#define InvalidSnapshot   ((Snapshot) NULL)
 

Typedefs

typedef enum SnapshotType SnapshotType
 
typedef struct SnapshotDataSnapshot
 
typedef struct SnapshotData SnapshotData
 

Enumerations

enum  SnapshotType {
  SNAPSHOT_MVCC = 0, SNAPSHOT_SELF, SNAPSHOT_ANY, SNAPSHOT_TOAST,
  SNAPSHOT_DIRTY, SNAPSHOT_HISTORIC_MVCC, SNAPSHOT_NON_VACUUMABLE
}
 

Macro Definition Documentation

◆ InvalidSnapshot

Typedef Documentation

◆ Snapshot

typedef struct SnapshotData* Snapshot

Definition at line 121 of file snapshot.h.

◆ SnapshotData

typedef struct SnapshotData SnapshotData

◆ SnapshotType

typedef enum SnapshotType SnapshotType

Enumeration Type Documentation

◆ SnapshotType

Enumerator
SNAPSHOT_MVCC 
SNAPSHOT_SELF 
SNAPSHOT_ANY 
SNAPSHOT_TOAST 
SNAPSHOT_DIRTY 
SNAPSHOT_HISTORIC_MVCC 
SNAPSHOT_NON_VACUUMABLE 

Definition at line 35 of file snapshot.h.

36 {
37  /*-------------------------------------------------------------------------
38  * A tuple is visible iff the tuple is valid for the given MVCC snapshot.
39  *
40  * Here, we consider the effects of:
41  * - all transactions committed as of the time of the given snapshot
42  * - previous commands of this transaction
43  *
44  * Does _not_ include:
45  * - transactions shown as in-progress by the snapshot
46  * - transactions started after the snapshot was taken
47  * - changes made by the current command
48  * -------------------------------------------------------------------------
49  */
50  SNAPSHOT_MVCC = 0,
51 
52  /*-------------------------------------------------------------------------
53  * A tuple is visible iff the tuple is valid "for itself".
54  *
55  * Here, we consider the effects of:
56  * - all committed transactions (as of the current instant)
57  * - previous commands of this transaction
58  * - changes made by the current command
59  *
60  * Does _not_ include:
61  * - in-progress transactions (as of the current instant)
62  * -------------------------------------------------------------------------
63  */
65 
66  /*
67  * Any tuple is visible.
68  */
70 
71  /*
72  * A tuple is visible iff the tuple is valid as a TOAST row.
73  */
75 
76  /*-------------------------------------------------------------------------
77  * A tuple is visible iff the tuple is valid including effects of open
78  * transactions.
79  *
80  * Here, we consider the effects of:
81  * - all committed and in-progress transactions (as of the current instant)
82  * - previous commands of this transaction
83  * - changes made by the current command
84  *
85  * This is essentially like SNAPSHOT_SELF as far as effects of the current
86  * transaction and committed/aborted xacts are concerned. However, it
87  * also includes the effects of other xacts still in progress.
88  *
89  * A special hack is that when a snapshot of this type is used to
90  * determine tuple visibility, the passed-in snapshot struct is used as an
91  * output argument to return the xids of concurrent xacts that affected
92  * the tuple. snapshot->xmin is set to the tuple's xmin if that is
93  * another transaction that's still in progress; or to
94  * InvalidTransactionId if the tuple's xmin is committed good, committed
95  * dead, or my own xact. Similarly for snapshot->xmax and the tuple's
96  * xmax. If the tuple was inserted speculatively, meaning that the
97  * inserter might still back down on the insertion without aborting the
98  * whole transaction, the associated token is also returned in
99  * snapshot->speculativeToken. See also InitDirtySnapshot().
100  * -------------------------------------------------------------------------
101  */
103 
104  /*
105  * A tuple is visible iff it follows the rules of SNAPSHOT_MVCC, but
106  * supports being called in timetravel context (for decoding catalog
107  * contents in the context of logical decoding).
108  */
110 
111  /*
112  * A tuple is visible iff the tuple might be visible to some transaction;
113  * false if it's surely dead to everyone, i.e., vacuumable.
114  *
115  * For visibility checks snapshot->min must have been set up with the xmin
116  * horizon to use.
117  */
119 } SnapshotType;
SnapshotType
Definition: snapshot.h:35