mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-03-07 19:47:50 +08:00
Fix and improve SnapshotType comments.
The comment for SNAPSHOT_SELF was unfortunately explaining SNAPSHOT_DIRTY, as reported by Sergei. Also expand a few comments, and include a few more comments from heapam_visibility.c, so they're in an AM independent place. Reported-By: Sergei Kornilov Author: Andres Freund Discussion: https://postgr.es/m/9152241558192351@sas1-d856b3d759c7.qloud-c.yandex.net
This commit is contained in:
parent
ae35e1c9d7
commit
78d6a9cbd3
@ -50,13 +50,15 @@ typedef enum SnapshotType
|
|||||||
SNAPSHOT_MVCC = 0,
|
SNAPSHOT_MVCC = 0,
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------
|
/*-------------------------------------------------------------------------
|
||||||
* A tuple is visible iff the tuple is valid including effects of open
|
* A tuple is visible iff the tuple is valid "for itself".
|
||||||
* transactions.
|
|
||||||
*
|
*
|
||||||
* Here, we consider the effects of:
|
* Here, we consider the effects of:
|
||||||
* - all committed and in-progress transactions (as of the current instant)
|
* - all committed transactions (as of the current instant)
|
||||||
* - previous commands of this transaction
|
* - previous commands of this transaction
|
||||||
* - changes made by the current command
|
* - changes made by the current command
|
||||||
|
*
|
||||||
|
* Does _not_ include:
|
||||||
|
* - in-progress transactions (as of the current instant)
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
SNAPSHOT_SELF,
|
SNAPSHOT_SELF,
|
||||||
@ -79,6 +81,22 @@ typedef enum SnapshotType
|
|||||||
* - all committed and in-progress transactions (as of the current instant)
|
* - all committed and in-progress transactions (as of the current instant)
|
||||||
* - previous commands of this transaction
|
* - previous commands of this transaction
|
||||||
* - changes made by the current command
|
* - changes made by the current command
|
||||||
|
*
|
||||||
|
* This is essentially like SNAPSHOT_SELF as far as effects of the current
|
||||||
|
* transaction and committed/aborted xacts are concerned. However, it
|
||||||
|
* also includes the effects of other xacts still in progress.
|
||||||
|
*
|
||||||
|
* A special hack is that when a snapshot of this type is used to
|
||||||
|
* determine tuple visibility, the passed-in snapshot struct is used as an
|
||||||
|
* output argument to return the xids of concurrent xacts that affected
|
||||||
|
* the tuple. snapshot->xmin is set to the tuple's xmin if that is
|
||||||
|
* another transaction that's still in progress; or to
|
||||||
|
* InvalidTransactionId if the tuple's xmin is committed good, committed
|
||||||
|
* dead, or my own xact. Similarly for snapshot->xmax and the tuple's
|
||||||
|
* xmax. If the tuple was inserted speculatively, meaning that the
|
||||||
|
* inserter might still back down on the insertion without aborting the
|
||||||
|
* whole transaction, the associated token is also returned in
|
||||||
|
* snapshot->speculativeToken. See also InitDirtySnapshot().
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
SNAPSHOT_DIRTY,
|
SNAPSHOT_DIRTY,
|
||||||
@ -92,9 +110,10 @@ typedef enum SnapshotType
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* A tuple is visible iff the tuple might be visible to some transaction;
|
* A tuple is visible iff the tuple might be visible to some transaction;
|
||||||
* false if it's surely dead to everyone, ie, vacuumable.
|
* false if it's surely dead to everyone, i.e., vacuumable.
|
||||||
*
|
*
|
||||||
* Snapshot.xmin must have been set up with the xmin horizon to use.
|
* For visibility checks snapshot->min must have been set up with the xmin
|
||||||
|
* horizon to use.
|
||||||
*/
|
*/
|
||||||
SNAPSHOT_NON_VACUUMABLE
|
SNAPSHOT_NON_VACUUMABLE
|
||||||
} SnapshotType;
|
} SnapshotType;
|
||||||
|
Loading…
Reference in New Issue
Block a user