Skip to content

Commit c863091

Browse files
committed
SSI comment fixes and enhancements. Notably, document that the conflict-out
flag actually means that the transaction has a conflict out to a transaction that committed before the flagged transaction. Kevin Grittner
1 parent 52caa35 commit c863091

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

src/backend/storage/lmgr/predicate.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,11 @@
245245
#define SxactIsReadOnly(sxact) (((sxact)->flags & SXACT_FLAG_READ_ONLY) != 0)
246246
#define SxactHasSummaryConflictIn(sxact) (((sxact)->flags & SXACT_FLAG_SUMMARY_CONFLICT_IN) != 0)
247247
#define SxactHasSummaryConflictOut(sxact) (((sxact)->flags & SXACT_FLAG_SUMMARY_CONFLICT_OUT) != 0)
248+
/*
249+
* The following macro actually means that the specified transaction has a
250+
* conflict out *to a transaction which committed ahead of it*. It's hard
251+
* to get that into a name of a reasonable length.
252+
*/
248253
#define SxactHasConflictOut(sxact) (((sxact)->flags & SXACT_FLAG_CONFLICT_OUT) != 0)
249254
#define SxactIsDeferrableWaiting(sxact) (((sxact)->flags & SXACT_FLAG_DEFERRABLE_WAITING) != 0)
250255
#define SxactIsROSafe(sxact) (((sxact)->flags & SXACT_FLAG_RO_SAFE) != 0)
@@ -2708,7 +2713,7 @@ SetNewSxactGlobalXmin(void)
27082713
* up in some relatively timely fashion.
27092714
*
27102715
* If this transaction is committing and is holding any predicate locks,
2711-
* it must be added to a list of completed serializable transaction still
2716+
* it must be added to a list of completed serializable transactions still
27122717
* holding locks.
27132718
*/
27142719
void
@@ -2753,12 +2758,13 @@ ReleasePredicateLocks(const bool isCommit)
27532758
LWLockAcquire(SerializableXactHashLock, LW_EXCLUSIVE);
27542759

27552760
/*
2756-
* We don't hold a lock here, assuming that TransactionId is atomic!
2761+
* We don't hold XidGenLock lock here, assuming that TransactionId is
2762+
* atomic!
27572763
*
27582764
* If this value is changing, we don't care that much whether we get the
27592765
* old or new value -- it is just used to determine how far
2760-
* GlobalSerizableXmin must advance before this transaction can be cleaned
2761-
* fully cleaned up. The worst that could happen is we wait for ome more
2766+
* GlobalSerizableXmin must advance before this transaction can be fully
2767+
* cleaned up. The worst that could happen is we wait for one more
27622768
* transaction to complete before freeing some RAM; correctness of visible
27632769
* behavior is not affected.
27642770
*/
@@ -3860,8 +3866,8 @@ OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader,
38603866
* Because T2 must've committed first, there is no anomaly if:
38613867
* - the reader committed before T2
38623868
* - the writer committed before T2
3863-
* - the reader is a READ ONLY transaction and the reader was not
3864-
* concurrent with T2 (= reader acquired its snapshot after T2 committed)
3869+
* - the reader is a READ ONLY transaction and the reader was concurrent
3870+
* with T2 (= reader acquired its snapshot before T2 committed)
38653871
*/
38663872
if (!failure)
38673873
{

src/include/storage/predicate_internals.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ typedef struct SERIALIZABLEXACT
9292

9393
#define SXACT_FLAG_ROLLED_BACK 0x00000001
9494
#define SXACT_FLAG_COMMITTED 0x00000002
95+
/*
96+
* The following flag actually means that the flagged transaction has a
97+
* conflict out *to a transaction which committed ahead of it*. It's hard
98+
* to get that into a name of a reasonable length.
99+
*/
95100
#define SXACT_FLAG_CONFLICT_OUT 0x00000004
96101
#define SXACT_FLAG_READ_ONLY 0x00000008
97102
#define SXACT_FLAG_DID_WRITE 0x00000010

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy