Skip to content

Commit 02e6a11

Browse files
committed
Add fast paths for cases when no serializable transactions are running.
Dan Ports
1 parent 97e8346 commit 02e6a11

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/backend/storage/lmgr/predicate.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2275,6 +2275,18 @@ PredicateLockTupleRowVersionLink(const Relation relation,
22752275
TransactionId oldxmin,
22762276
newxmin;
22772277

2278+
/*
2279+
* Bail out quickly if there are no serializable transactions
2280+
* running.
2281+
*
2282+
* It's safe to do this check without taking any additional
2283+
* locks. Even if a serializable transaction starts concurrently,
2284+
* we know it can't take any SIREAD locks on the modified tuple
2285+
* because the caller is holding the associated buffer page lock.
2286+
*/
2287+
if (!TransactionIdIsValid(PredXact->SxactGlobalXmin))
2288+
return;
2289+
22782290
oldblk = ItemPointerGetBlockNumber(&(oldTuple->t_self));
22792291
oldoff = ItemPointerGetOffsetNumber(&(oldTuple->t_self));
22802292
oldxmin = HeapTupleHeaderGetXmin(oldTuple->t_data);
@@ -2633,6 +2645,15 @@ PredicateLockPageSplit(const Relation relation, const BlockNumber oldblkno,
26332645
PREDICATELOCKTARGETTAG newtargettag;
26342646
bool success;
26352647

2648+
/*
2649+
* Bail out quickly if there are no serializable transactions
2650+
* running. As with PredicateLockTupleRowVersionLink, it's safe to
2651+
* check this without taking locks because the caller is holding
2652+
* the buffer page lock.
2653+
*/
2654+
if (!TransactionIdIsValid(PredXact->SxactGlobalXmin))
2655+
return;
2656+
26362657
if (SkipSplitTracking(relation))
26372658
return;
26382659

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