Commit f7feb020 authored by Thomas Munro's avatar Thomas Munro

Fix GetNewTransactionId()'s interaction with xidVacLimit.

Commit ad308058 switched to returning a FullTransactionId, but
failed to load the potentially updated value in the case where
xidVacLimit is reached and we release and reacquire the lock.
Repair, closing bug #15727.

While reviewing that commit, also fix the size computation used
by EstimateTransactionStateSize() and switch to the mul_size()
macro traditionally used in such expressions.

Author: Thomas Munro
Reported-by: Roman Zharkov
Discussion: https://postgr.es/m/15727-0be246e7d852d229%40postgresql.org
parent d87ab886
......@@ -159,7 +159,8 @@ GetNewTransactionId(bool isSubXact)
/* Re-acquire lock and start over */
LWLockAcquire(XidGenLock, LW_EXCLUSIVE);
xid = XidFromFullTransactionId(ShmemVariableCache->nextFullXid);
full_xid = ShmemVariableCache->nextFullXid;
xid = XidFromFullTransactionId(full_xid);
}
/*
......
......@@ -5151,7 +5151,7 @@ EstimateTransactionStateSpace(void)
nxids = add_size(nxids, s->nChildXids);
}
return add_size(size, sizeof(SerializedTransactionState) * nxids);
return add_size(size, mul_size(sizeof(TransactionId), nxids));
}
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment