Skip to content

Commit 706f9dd

Browse files
committed
Fix old visibility bug in HeapTupleSatisfiesDirty
If a tuple is locked but not updated by a concurrent transaction, HeapTupleSatisfiesDirty would return that transaction's Xid in xmax, causing callers to wait on it, when it is not necessary (in fact, if the other transaction had used a multixact instead of a plain Xid to mark the tuple, HeapTupleSatisfiesDirty would have behave differently and *not* returned the Xmax). This bug was introduced in commit 3f7fbf8, dated December 1998, so it's almost 15 years old now. However, it's hard to see this misbehave, because before we had NOWAIT the only consequence of this is that transactions would wait for slightly more time than necessary; so it's not surprising that this hasn't been reported yet. Craig Ringer and Andres Freund
1 parent 88c5566 commit 706f9dd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/backend/utils/time/tqual.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,8 @@ HeapTupleSatisfiesDirty(HeapTuple htup, Snapshot snapshot,
803803

804804
if (TransactionIdIsInProgress(HeapTupleHeaderGetRawXmax(tuple)))
805805
{
806-
snapshot->xmax = HeapTupleHeaderGetRawXmax(tuple);
806+
if (!HEAP_XMAX_IS_LOCKED_ONLY(tuple->t_infomask))
807+
snapshot->xmax = HeapTupleHeaderGetRawXmax(tuple);
807808
return true;
808809
}
809810

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