On 03.06.2016 16:05, Amit Kapila wrote:
Sorry, but right now I have not replaced existed functions
EstimateTransactionStateSpace/SerializeTransactionState/StartParallelWorkerTransaction
with XTM indirect calls. If was my original intention, but these functions access static variable CurrentTransactionState defined in xact.c.
So if user-defined TM wants to override this functions, it will have to invoke original functions to save/restore CurrentTransactionState.
It is not convenient.
This is why three XTM functions above are now called by existed xact funcations to save additional state, for example:
Size
EstimateTransactionStateSpace(void)
{
TransactionState s;
Size nxids = 6; /* iso level, deferrable, top & current XID,
* command counter, XID count */
for (s = CurrentTransactionState; s != NULL; s = s->parent)
{
if (TransactionIdIsValid(s->transactionId))
nxids = add_size(nxids, 1);
nxids = add_size(nxids, s->nChildXids);
}
nxids = add_size(nxids, nParallelCurrentXids);
nxids = mul_size(nxids, sizeof(TransactionId));
return add_size(nxids,
TM->GetTransactionStateSize());
}
--
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company