Commit d7811382 authored by Bruce Momjian's avatar Bruce Momjian

Add more comments to tqual.c for visibility functions.

parent cf97080f
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.47 2002/01/16 20:29:02 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.48 2002/01/16 23:09:09 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -38,9 +38,12 @@ bool ReferentialIntegritySnapshotOverride = false; ...@@ -38,9 +38,12 @@ bool ReferentialIntegritySnapshotOverride = false;
/* /*
* HeapTupleSatisfiesItself * HeapTupleSatisfiesItself
* True iff heap tuple is valid for "itself." *
* "itself" means valid as of everything that's happened * Visible tuples are those of:
* in the current transaction, _including_ the current command. *
* transactions committed before our _command_ started (READ COMMITTED)
* previous commands of this transaction
* changes made by the current command
* *
* Note: * Note:
* Assumes heap tuple is valid. * Assumes heap tuple is valid.
...@@ -153,10 +156,13 @@ HeapTupleSatisfiesItself(HeapTupleHeader tuple) ...@@ -153,10 +156,13 @@ HeapTupleSatisfiesItself(HeapTupleHeader tuple)
/* /*
* HeapTupleSatisfiesNow * HeapTupleSatisfiesNow
* True iff heap tuple is valid "now." *
* "now" means valid including everything that's happened * Visible tuples are those of:
* in the current transaction _up to, but not including,_ *
* the current command. * transactions committed before our _command_ started (READ COMMITTED)
* previous commands of this transaction
*
* Does _not_ include changes made by the current command
* *
* Note: * Note:
* Assumes heap tuple is valid. * Assumes heap tuple is valid.
...@@ -296,11 +302,12 @@ HeapTupleSatisfiesNow(HeapTupleHeader tuple) ...@@ -296,11 +302,12 @@ HeapTupleSatisfiesNow(HeapTupleHeader tuple)
/* /*
* HeapTupleSatisfiesToast * HeapTupleSatisfiesToast
* True iff heap tuple is valid for TOAST usage. *
* Valid if the heap tuple is valid for TOAST usage.
* *
* This is a simplified version that only checks for VACUUM moving conditions. * This is a simplified version that only checks for VACUUM moving conditions.
* It's appropriate for TOAST usage because TOAST really doesn't want to do * It's appropriate for TOAST usage because TOAST really doesn't want to do
* its own time qual checks; if you can see the main-table row that contains * its own time qual checks; if you can see the main table row that contains
* a TOAST reference, you should be able to see the TOASTed value. However, * a TOAST reference, you should be able to see the TOASTed value. However,
* vacuuming a TOAST table is independent of the main table, and in case such * vacuuming a TOAST table is independent of the main table, and in case such
* a vacuum fails partway through, we'd better do this much checking. * a vacuum fails partway through, we'd better do this much checking.
...@@ -353,11 +360,13 @@ HeapTupleSatisfiesToast(HeapTupleHeader tuple) ...@@ -353,11 +360,13 @@ HeapTupleSatisfiesToast(HeapTupleHeader tuple)
/* /*
* HeapTupleSatisfiesUpdate * HeapTupleSatisfiesUpdate
* Check whether a tuple can be updated.
* *
* This applies exactly the same checks as HeapTupleSatisfiesNow, * Same as HeapTupleSatisfiesNow, but returns more information needed
* but returns a more-detailed result code, since UPDATE needs to know * by UPDATE.
* more than "is it visible?" *
* This applies the same checks as HeapTupleSatisfiesNow,
* but returns a more detailed result code, since UPDATE needs to know
* more than "is it visible?".
*/ */
int int
HeapTupleSatisfiesUpdate(HeapTuple htuple) HeapTupleSatisfiesUpdate(HeapTuple htuple)
...@@ -475,9 +484,13 @@ HeapTupleSatisfiesUpdate(HeapTuple htuple) ...@@ -475,9 +484,13 @@ HeapTupleSatisfiesUpdate(HeapTuple htuple)
return HeapTupleUpdated; /* updated by other */ return HeapTupleUpdated; /* updated by other */
} }
/* /* HeapTupleSatisfiesDirty
* HeapTupleSatisfiesDirty *
* True iff heap tuple is valid, including effects of concurrent xacts. * Visible tuples are those of:
*
* _any_ in-progress transaction
* previous commands of this transaction
* changes by the current command
* *
* This is essentially like HeapTupleSatisfiesItself as far as effects of * This is essentially like HeapTupleSatisfiesItself as far as effects of
* the current transaction and committed/aborted xacts are concerned. * the current transaction and committed/aborted xacts are concerned.
...@@ -601,11 +614,20 @@ HeapTupleSatisfiesDirty(HeapTupleHeader tuple) ...@@ -601,11 +614,20 @@ HeapTupleSatisfiesDirty(HeapTupleHeader tuple)
/* /*
* HeapTupleSatisfiesSnapshot * HeapTupleSatisfiesSnapshot
* True iff heap tuple is valid for the given snapshot. *
* Visible tuples are those of:
*
* transactions committed before our transaction started (SERIALIZABLE)
* previous commands of this transaction
*
* Does _not_ include:
* transactions in-progress when our transaction started
* transactions committed after our transaction started
* changes made by the current command
* *
* This is the same as HeapTupleSatisfiesNow, except that transactions that * This is the same as HeapTupleSatisfiesNow, except that transactions that
* were in progress or as yet unstarted when the snapshot was taken will * were in progress or as yet unstarted when the snapshot was taken will
* be treated as uncommitted, even if they really have committed by now. * be treated as uncommitted, even if they have committed by now.
* *
* (Notice, however, that the tuple status hint bits will be updated on the * (Notice, however, that the tuple status hint bits will be updated on the
* basis of the true state of the transaction, even if we then pretend we * basis of the true state of the transaction, even if we then pretend we
...@@ -746,8 +768,13 @@ HeapTupleSatisfiesSnapshot(HeapTupleHeader tuple, Snapshot snapshot) ...@@ -746,8 +768,13 @@ HeapTupleSatisfiesSnapshot(HeapTupleHeader tuple, Snapshot snapshot)
/* /*
* HeapTupleSatisfiesVacuum - determine tuple status for VACUUM and related * HeapTupleSatisfiesVacuum
* operations *
* Visible tuples are those of:
*
* tuples visible by any running transaction
*
* Used by VACUUM and related operations.
* *
* OldestXmin is a cutoff XID (obtained from GetOldestXmin()). Tuples * OldestXmin is a cutoff XID (obtained from GetOldestXmin()). Tuples
* deleted by XIDs >= OldestXmin are deemed "recently dead"; they might * deleted by XIDs >= OldestXmin are deemed "recently dead"; they might
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment