diff options
author | Peter Geoghegan <pg@bowt.ie> | 2023-01-11 15:31:42 -0800 |
---|---|---|
committer | Peter Geoghegan <pg@bowt.ie> | 2023-01-11 15:31:42 -0800 |
commit | af3855cb77b94a0321b77d7d9a9849700ea6a758 (patch) | |
tree | 790c88394c39ec57c0841dddc59c97dc0db23c5b /src/backend/access/transam/transam.c | |
parent | 8bf6ec3ba3a44448817af47a080587f3b71bee08 (diff) | |
download | postgresql-af3855cb77b94a0321b77d7d9a9849700ea6a758.tar.gz postgresql-af3855cb77b94a0321b77d7d9a9849700ea6a758.zip |
Improve TransactionIdDidAbort() documentation.
Document that TransactionIdDidAbort() won't indicate that transactions
that were in-progress during a crash have aborted. Tie this to existing
discussion of the TransactionIdDidCommit() and TransactionIdDidCommit()
protocol that code in heapam_visibility.c (and a few other places) must
observe.
Follow-up to bugfix commit eb5ad4ff.
Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/CAH2-Wzn4bEEqgmaUQL3aJ73yM9gAeK-wE4ngi7kjRjLztb+P0w@mail.gmail.com
Diffstat (limited to 'src/backend/access/transam/transam.c')
-rw-r--r-- | src/backend/access/transam/transam.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c index 3a28dcc43aa..7629904bbf7 100644 --- a/src/backend/access/transam/transam.c +++ b/src/backend/access/transam/transam.c @@ -110,7 +110,8 @@ TransactionLogFetch(TransactionId transactionId) * transaction tree. * * See also TransactionIdIsInProgress, which once was in this module - * but now lives in procarray.c. + * but now lives in procarray.c, as well as comments at the top of + * heapam_visibility.c that explain how everything fits together. * ---------------------------------------------------------------- */ @@ -176,6 +177,12 @@ TransactionIdDidCommit(TransactionId transactionId) * * Note: * Assumes transaction identifier is valid and exists in clog. + * + * Returns true only for explicitly aborted transactions, as transactions + * implicitly aborted due to a crash will commonly still appear to be + * in-progress in the clog. Most of the time TransactionIdDidCommit(), + * with a preceding TransactionIdIsInProgress() check, should be used + * instead of TransactionIdDidAbort(). */ bool /* true if given transaction aborted */ TransactionIdDidAbort(TransactionId transactionId) |