mirror of https://github.com/citusdata/citus.git
Don't override xact id assigned by coordinator on workers.
We might need to send commands from workers to other workers. In these cases we shouldn't override the xact id assigned by coordinator, or otherwise we won't read the consistent set of result files accross the nodes.pull/3363/head
parent
bb65669186
commit
e1e383cb59
|
@ -117,7 +117,8 @@ static bool MaybeExecutingUDF(void);
|
||||||
void
|
void
|
||||||
UseCoordinatedTransaction(void)
|
UseCoordinatedTransaction(void)
|
||||||
{
|
{
|
||||||
if (CurrentCoordinatedTransactionState == COORD_TRANS_STARTED)
|
if (CurrentCoordinatedTransactionState == COORD_TRANS_STARTED ||
|
||||||
|
CurrentCoordinatedTransactionState == COORD_TRANS_STARTED_ON_WORKER)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -130,7 +131,21 @@ UseCoordinatedTransaction(void)
|
||||||
|
|
||||||
CurrentCoordinatedTransactionState = COORD_TRANS_STARTED;
|
CurrentCoordinatedTransactionState = COORD_TRANS_STARTED;
|
||||||
|
|
||||||
AssignDistributedTransactionId();
|
/*
|
||||||
|
* This might be part of bigger distributed transaction originating from
|
||||||
|
* another node, in which case transaction id has already been assigned
|
||||||
|
* by a assign_distributed_transaction_id() call.
|
||||||
|
*/
|
||||||
|
DistributedTransactionId *transactionId = GetCurrentDistributedTransactionId();
|
||||||
|
if (transactionId->transactionNumber == 0)
|
||||||
|
{
|
||||||
|
CurrentCoordinatedTransactionState = COORD_TRANS_STARTED_ON_WORKER;
|
||||||
|
AssignDistributedTransactionId();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CurrentCoordinatedTransactionState = COORD_TRANS_STARTED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,13 @@ typedef enum CoordinatedTransactionState
|
||||||
/* no coordinated transaction in progress, but connections established */
|
/* no coordinated transaction in progress, but connections established */
|
||||||
COORD_TRANS_IDLE,
|
COORD_TRANS_IDLE,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Coordinated transaction was initiated by coordinator, but the worker also
|
||||||
|
* needs to start a coordinated transaction to be able to send commands to
|
||||||
|
* other workers.
|
||||||
|
*/
|
||||||
|
COORD_TRANS_STARTED_ON_WORKER,
|
||||||
|
|
||||||
/* coordinated transaction in progress */
|
/* coordinated transaction in progress */
|
||||||
COORD_TRANS_STARTED,
|
COORD_TRANS_STARTED,
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue