mirror of https://github.com/citusdata/citus.git
Merge pull request #2942 from citusdata/fix_adaptive_bug
Make sure that lost connections are handled properly in adaptive executorpull/2941/head^2
commit
dd4e767702
|
@ -2412,6 +2412,7 @@ TransactionStateMachine(WorkerSession *session)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TaskPlacementExecution *placementExecution = NULL;
|
TaskPlacementExecution *placementExecution = NULL;
|
||||||
|
bool placementExecutionStarted = false;
|
||||||
|
|
||||||
placementExecution = PopPlacementExecution(session);
|
placementExecution = PopPlacementExecution(session);
|
||||||
if (placementExecution == NULL)
|
if (placementExecution == NULL)
|
||||||
|
@ -2425,7 +2426,17 @@ TransactionStateMachine(WorkerSession *session)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
StartPlacementExecutionOnSession(placementExecution, session);
|
placementExecutionStarted =
|
||||||
|
StartPlacementExecutionOnSession(placementExecution, session);
|
||||||
|
if (!placementExecutionStarted)
|
||||||
|
{
|
||||||
|
/* no need to continue, connection is lost */
|
||||||
|
Assert(session->connection->connectionState ==
|
||||||
|
MULTI_CONNECTION_LOST);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
transaction->transactionState = REMOTE_TRANS_SENT_COMMAND;
|
transaction->transactionState = REMOTE_TRANS_SENT_COMMAND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2494,6 +2505,7 @@ TransactionStateMachine(WorkerSession *session)
|
||||||
case REMOTE_TRANS_STARTED:
|
case REMOTE_TRANS_STARTED:
|
||||||
{
|
{
|
||||||
TaskPlacementExecution *placementExecution = NULL;
|
TaskPlacementExecution *placementExecution = NULL;
|
||||||
|
bool placementExecutionStarted = false;
|
||||||
|
|
||||||
placementExecution = PopPlacementExecution(session);
|
placementExecution = PopPlacementExecution(session);
|
||||||
if (placementExecution == NULL)
|
if (placementExecution == NULL)
|
||||||
|
@ -2503,7 +2515,16 @@ TransactionStateMachine(WorkerSession *session)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
StartPlacementExecutionOnSession(placementExecution, session);
|
placementExecutionStarted =
|
||||||
|
StartPlacementExecutionOnSession(placementExecution, session);
|
||||||
|
if (!placementExecutionStarted)
|
||||||
|
{
|
||||||
|
/* no need to continue, connection is lost */
|
||||||
|
Assert(session->connection->connectionState == MULTI_CONNECTION_LOST);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
transaction->transactionState = REMOTE_TRANS_SENT_COMMAND;
|
transaction->transactionState = REMOTE_TRANS_SENT_COMMAND;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2539,7 +2560,6 @@ TransactionStateMachine(WorkerSession *session)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* iterate in case we can perform multiple transitions at once */
|
/* iterate in case we can perform multiple transitions at once */
|
||||||
while (transaction->transactionState != currentState);
|
while (transaction->transactionState != currentState);
|
||||||
}
|
}
|
||||||
|
@ -2748,6 +2768,8 @@ StartPlacementExecutionOnSession(TaskPlacementExecution *placementExecution,
|
||||||
|
|
||||||
/* connection is going to be in use */
|
/* connection is going to be in use */
|
||||||
workerPool->idleConnectionCount--;
|
workerPool->idleConnectionCount--;
|
||||||
|
session->currentTask = placementExecution;
|
||||||
|
placementExecution->executionState = PLACEMENT_EXECUTION_RUNNING;
|
||||||
|
|
||||||
if (paramListInfo != NULL)
|
if (paramListInfo != NULL)
|
||||||
{
|
{
|
||||||
|
@ -2781,9 +2803,6 @@ StartPlacementExecutionOnSession(TaskPlacementExecution *placementExecution,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
session->currentTask = placementExecution;
|
|
||||||
placementExecution->executionState = PLACEMENT_EXECUTION_RUNNING;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue