Skip to content

Commit f2c87ac

Browse files
committed
Remove long-unused TransactionIdIsActive()
TransactionIdIsActive() has not been used since bb38fb0, in 2014. There are no known uses in extensions either and it's hard to see valid uses for it. Therefore remove TransactionIdIsActive(). Discussion: https://postgr.es/m/odgftbtwp5oq7cxjgf4kjkmyq7ypoftmqy7eqa7w3awnouzot6@hrwnl5tdqrgu
1 parent b8e1f2d commit f2c87ac

File tree

2 files changed

+0
-53
lines changed

2 files changed

+0
-53
lines changed

src/backend/storage/ipc/procarray.c

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,58 +1622,6 @@ TransactionIdIsInProgress(TransactionId xid)
16221622
return false;
16231623
}
16241624

1625-
/*
1626-
* TransactionIdIsActive -- is xid the top-level XID of an active backend?
1627-
*
1628-
* This differs from TransactionIdIsInProgress in that it ignores prepared
1629-
* transactions, as well as transactions running on the primary if we're in
1630-
* hot standby. Also, we ignore subtransactions since that's not needed
1631-
* for current uses.
1632-
*/
1633-
bool
1634-
TransactionIdIsActive(TransactionId xid)
1635-
{
1636-
bool result = false;
1637-
ProcArrayStruct *arrayP = procArray;
1638-
TransactionId *other_xids = ProcGlobal->xids;
1639-
int i;
1640-
1641-
/*
1642-
* Don't bother checking a transaction older than RecentXmin; it could not
1643-
* possibly still be running.
1644-
*/
1645-
if (TransactionIdPrecedes(xid, RecentXmin))
1646-
return false;
1647-
1648-
LWLockAcquire(ProcArrayLock, LW_SHARED);
1649-
1650-
for (i = 0; i < arrayP->numProcs; i++)
1651-
{
1652-
int pgprocno = arrayP->pgprocnos[i];
1653-
PGPROC *proc = &allProcs[pgprocno];
1654-
TransactionId pxid;
1655-
1656-
/* Fetch xid just once - see GetNewTransactionId */
1657-
pxid = UINT32_ACCESS_ONCE(other_xids[i]);
1658-
1659-
if (!TransactionIdIsValid(pxid))
1660-
continue;
1661-
1662-
if (proc->pid == 0)
1663-
continue; /* ignore prepared transactions */
1664-
1665-
if (TransactionIdEquals(pxid, xid))
1666-
{
1667-
result = true;
1668-
break;
1669-
}
1670-
}
1671-
1672-
LWLockRelease(ProcArrayLock);
1673-
1674-
return result;
1675-
}
1676-
16771625

16781626
/*
16791627
* Determine XID horizons.

src/include/storage/procarray.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ extern bool ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc);
5353
extern RunningTransactions GetRunningTransactionData(void);
5454

5555
extern bool TransactionIdIsInProgress(TransactionId xid);
56-
extern bool TransactionIdIsActive(TransactionId xid);
5756
extern TransactionId GetOldestNonRemovableTransactionId(Relation rel);
5857
extern TransactionId GetOldestTransactionIdConsideredRunning(void);
5958
extern TransactionId GetOldestActiveTransactionId(void);

0 commit comments

Comments
 (0)