Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7aa4fb5

Browse files
committed
Improve comments for [Heap]CheckForSerializableConflictOut().
Rewrite the documentation of these functions, in light of recent bug fix commit 5940ffb. Back-patch to 13 where the check-for-conflict-out code was split up into AM-specific and generic parts, and new documentation was added that now looked wrong. Reviewed-by: Peter Geoghegan <pg@bowt.ie> Discussion: https://postgr.es/m/db7b729d-0226-d162-a126-8a8ab2dc4443%40jepsen.io
1 parent 59fa7eb commit 7aa4fb5

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

src/backend/access/heap/heapam.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8975,15 +8975,13 @@ heap_mask(char *pagedata, BlockNumber blkno)
89758975

89768976
/*
89778977
* HeapCheckForSerializableConflictOut
8978-
* We are reading a tuple which has been modified. If it is visible to
8979-
* us but has been deleted, that indicates a rw-conflict out. If it's
8980-
* not visible and was created by a concurrent (overlapping)
8981-
* serializable transaction, that is also a rw-conflict out,
8978+
* We are reading a tuple. If it's not visible, there may be a
8979+
* rw-conflict out with the inserter. Otherwise, if it is visible to us
8980+
* but has been deleted, there may be a rw-conflict out with the deleter.
89828981
*
89838982
* We will determine the top level xid of the writing transaction with which
8984-
* we may be in conflict, and check for overlap with our own transaction.
8985-
* If the transactions overlap (i.e., they cannot see each other's writes),
8986-
* then we have a conflict out.
8983+
* we may be in conflict, and ask CheckForSerializableConflictOut() to check
8984+
* for overlap with our own transaction.
89878985
*
89888986
* This function should be called just about anywhere in heapam.c where a
89898987
* tuple has been read. The caller must hold at least a shared lock on the

src/backend/storage/lmgr/predicate.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4037,13 +4037,16 @@ CheckForSerializableConflictOutNeeded(Relation relation, Snapshot snapshot)
40374037

40384038
/*
40394039
* CheckForSerializableConflictOut
4040-
* A table AM is reading a tuple that has been modified. After determining
4041-
* that it is visible to us, it should call this function with the top
4042-
* level xid of the writing transaction.
4040+
* A table AM is reading a tuple that has been modified. If it determines
4041+
* that the tuple version it is reading is not visible to us, it should
4042+
* pass in the top level xid of the transaction that created it.
4043+
* Otherwise, if it determines that it is visible to us but it has been
4044+
* deleted or there is a newer version available due to an update, it
4045+
* should pass in the top level xid of the modifying transaction.
40434046
*
4044-
* This function will check for overlap with our own transaction. If the
4045-
* transactions overlap (i.e., they cannot see each other's writes), then we
4046-
* have a conflict out.
4047+
* This function will check for overlap with our own transaction. If the given
4048+
* xid is also serializable and the transactions overlap (i.e., they cannot see
4049+
* each other's writes), then we have a conflict out.
40474050
*/
40484051
void
40494052
CheckForSerializableConflictOut(Relation relation, TransactionId xid, Snapshot snapshot)

0 commit comments

Comments
 (0)