void
ProcArrayEndTransaction(PGPROC *proc, TransactionId latestXid)
{
+ /*
+ * XXX. This code can be further simplified now that we no longer
+ * use the PGPROC->xid fields to derive a snapshot.
+ */
+
if (TransactionIdIsValid(latestXid))
{
- /*
- * We must lock ProcArrayLock while clearing proc->xid, so that we do
- * not exit the set of "running" transactions while someone else is
- * taking a snapshot. See discussion in
- * src/backend/access/transam/README.
- */
Assert(TransactionIdIsValid(proc->xid));
- LWLockAcquire(ProcArrayLock, LW_EXCLUSIVE);
-
proc->xid = InvalidTransactionId;
proc->lxid = InvalidLocalTransactionId;
proc->xmin = InvalidTransactionId;
/* Clear the subtransaction-XID cache too while holding the lock */
proc->subxids.nxids = 0;
proc->subxids.overflowed = false;
-
- /* Also advance global latestCompletedXid while holding the lock */
- if (TransactionIdPrecedes(ShmemVariableCache->latestCompletedXid,
- latestXid))
- ShmemVariableCache->latestCompletedXid = latestXid;
-
- LWLockRelease(ProcArrayLock);
}
else
{
* any snapshot the other backend is taking concurrently with our scan cannot
* consider any transactions as still running that we think are committed
* (since backends must hold ProcArrayLock exclusive to commit).
+ *
+ * XXX: I think this is probably broken by the SnapArray stuff.
*/
VirtualTransactionId *
GetCurrentVirtualXIDs(TransactionId limitXmin, bool excludeXmin0,