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

Commit ee3838b

Browse files
committed
You must hold a lock on the heap page when you call
CheckForSerializableConflictOut(), because it can set hint bits. YAMAMOTO Takashi
1 parent 12bf602 commit ee3838b

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/backend/access/heap/heapam.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1472,10 +1472,10 @@ heap_fetch(Relation relation,
14721472
if (valid)
14731473
PredicateLockTuple(relation, tuple);
14741474

1475-
LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
1476-
14771475
CheckForSerializableConflictOut(valid, relation, tuple, buffer);
14781476

1477+
LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
1478+
14791479
if (valid)
14801480
{
14811481
/*

src/backend/storage/lmgr/predicate.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -3366,9 +3366,10 @@ XidIsConcurrent(TransactionId xid)
33663366
* If the transactions overlap (i.e., they cannot see each other's writes),
33673367
* then we have a conflict out.
33683368
*
3369-
* This function should be called just about anywhere in heapam.c that a
3370-
* tuple has been read. There is currently no known reason to call this
3371-
* function from an index AM.
3369+
* This function should be called just about anywhere in heapam.c where a
3370+
* tuple has been read. The caller must hold at least a shared lock on the
3371+
* buffer, because this function might set hint bits on the tuple. There is
3372+
* currently no known reason to call this function from an index AM.
33723373
*/
33733374
void
33743375
CheckForSerializableConflictOut(const bool visible, const Relation relation,

0 commit comments

Comments
 (0)