summaryrefslogtreecommitdiff
path: root/src/backend/storage/ipc
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/storage/ipc')
-rw-r--r--src/backend/storage/ipc/procarray.c5
-rw-r--r--src/backend/storage/ipc/standby.c24
2 files changed, 4 insertions, 25 deletions
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index 518c6d74b29..7f293d989b5 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -684,11 +684,8 @@ ProcArrayApplyRecoveryInfo(RunningTransactions running)
/*
* Remove stale locks, if any.
- *
- * Locks are always assigned to the toplevel xid so we don't need to care
- * about subxcnt/subxids (and by extension not about ->suboverflowed).
*/
- StandbyReleaseOldLocks(running->xcnt, running->xids);
+ StandbyReleaseOldLocks(running->oldestRunningXid);
/*
* If our snapshot is already valid, nothing else to do...
diff --git a/src/backend/storage/ipc/standby.c b/src/backend/storage/ipc/standby.c
index 38d6db1e126..1eacc5ec143 100644
--- a/src/backend/storage/ipc/standby.c
+++ b/src/backend/storage/ipc/standby.c
@@ -722,7 +722,7 @@ StandbyReleaseAllLocks(void)
* as long as they're not prepared transactions.
*/
void
-StandbyReleaseOldLocks(int nxids, TransactionId *xids)
+StandbyReleaseOldLocks(TransactionId oldxid)
{
ListCell *cell,
*prev,
@@ -741,26 +741,8 @@ StandbyReleaseOldLocks(int nxids, TransactionId *xids)
if (StandbyTransactionIdIsPrepared(lock->xid))
remove = false;
- else
- {
- int i;
- bool found = false;
-
- for (i = 0; i < nxids; i++)
- {
- if (lock->xid == xids[i])
- {
- found = true;
- break;
- }
- }
-
- /*
- * If its not a running transaction, remove it.
- */
- if (!found)
- remove = true;
- }
+ else if (TransactionIdPrecedes(lock->xid, oldxid))
+ remove = true;
if (remove)
{