* must be done _before_ releasing locks we hold and _after_
* RecordTransactionCommit.
*/
- ProcArrayEndTransaction(MyProc, latestXid);
if (TransactionIdIsNormal(xid))
SnapArrayRemoveRunningXids(xid, nchildren, children, latestXid);
+ ProcArrayEndTransaction(MyProc);
/*
* This is all post-commit cleanup. Note that if an error is raised here,
* must be done _before_ releasing locks we hold and _after_
* RecordTransactionAbort.
*/
- ProcArrayEndTransaction(MyProc, latestXid);
if (TransactionIdIsNormal(xid))
SnapArrayRemoveRunningXids(xid, nchildren, children, latestXid);
+ ProcArrayEndTransaction(MyProc);
/*
* Post-abort cleanup. See notes in CommitTransaction() concerning
* commit/abort must already be reported to WAL and pg_clog.
*
* proc is currently always MyProc, but we pass it explicitly for flexibility.
- * latestXid is the latest Xid among the transaction's main XID and
- * subtransactions, or InvalidTransactionId if it has no XID. (We must ask
- * the caller to pass latestXid, instead of computing it from the PGPROC's
- * contents, because the subxid information in the PGPROC might be
- * incomplete.)
*/
void
-ProcArrayEndTransaction(PGPROC *proc, TransactionId latestXid)
+ProcArrayEndTransaction(PGPROC *proc)
{
- /*
- * XXX. This code can be further simplified now that we no longer
- * use the PGPROC->xid fields to derive a snapshot.
- */
-
- if (TransactionIdIsValid(latestXid))
- {
- Assert(TransactionIdIsValid(proc->xid));
-
- proc->xid = InvalidTransactionId;
- proc->lxid = InvalidLocalTransactionId;
- proc->xmin = InvalidTransactionId;
- /* must be cleared with xid/xmin: */
- proc->vacuumFlags &= ~PROC_VACUUM_STATE_MASK;
- proc->inCommit = false; /* be sure this is cleared in abort */
- proc->recoveryConflictPending = false;
-
- /* Clear the subtransaction-XID cache too while holding the lock */
- proc->subxids.nxids = 0;
- proc->subxids.overflowed = false;
- }
- else
- {
- /*
- * If we have no XID, we don't need to lock, since we won't affect
- * anyone else's calculation of a snapshot. We might change their
- * estimate of global xmin, but that's OK.
- */
- Assert(!TransactionIdIsValid(proc->xid));
-
- proc->lxid = InvalidLocalTransactionId;
- proc->xmin = InvalidTransactionId;
- /* must be cleared with xid/xmin: */
- proc->vacuumFlags &= ~PROC_VACUUM_STATE_MASK;
- proc->inCommit = false; /* be sure this is cleared in abort */
- proc->recoveryConflictPending = false;
+ proc->xid = InvalidTransactionId;
+ proc->lxid = InvalidLocalTransactionId;
+ proc->xmin = InvalidTransactionId;
+ /* must be cleared with xid/xmin: */
+ proc->vacuumFlags &= ~PROC_VACUUM_STATE_MASK;
+ proc->inCommit = false; /* be sure this is cleared in abort */
+ proc->recoveryConflictPending = false;
- Assert(proc->subxids.nxids == 0);
- Assert(proc->subxids.overflowed == false);
- }
+ /* Clear the subtransaction-XID cache too while holding the lock */
+ proc->subxids.nxids = 0;
+ proc->subxids.overflowed = false;
}
-
/*
* ProcArrayClearTransaction -- clear the transaction fields
*