[I2B55F]: Fix: Consumer gets blocked if producer gets cancelled
This commit is contained in:
parent
43c964fd9e
commit
574afd4864
|
|
@ -555,9 +555,6 @@ public final class SqlStageExecution
|
|||
}
|
||||
if (finishedTasks.containsAll(allTasks)) {
|
||||
stateMachine.transitionToFinished();
|
||||
if (isReuseTableScanEnabled(stateMachine.getSession())) {
|
||||
setReuseTableScanMappingIdStatus(stateMachine);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -568,9 +565,9 @@ public final class SqlStageExecution
|
|||
}
|
||||
|
||||
//Assuming there will be only one table scan in one stage
|
||||
private static synchronized void setReuseTableScanMappingIdStatus(StageStateMachine state)
|
||||
public static synchronized void setReuseTableScanMappingIdStatus(StageStateMachine state)
|
||||
{
|
||||
if (state.getProducerScanNode() == null) {
|
||||
if (!isReuseTableScanEnabled(state.getSession()) || state.getProducerScanNode() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -203,23 +203,26 @@ public class StageStateMachine
|
|||
|
||||
public boolean transitionToFinished()
|
||||
{
|
||||
SqlStageExecution.setReuseTableScanMappingIdStatus(this);
|
||||
return stageState.setIf(FINISHED, currentState -> !currentState.isDone());
|
||||
}
|
||||
|
||||
public boolean transitionToCanceled()
|
||||
{
|
||||
SqlStageExecution.setReuseTableScanMappingIdStatus(this);
|
||||
return stageState.setIf(CANCELED, currentState -> !currentState.isDone());
|
||||
}
|
||||
|
||||
public boolean transitionToAborted()
|
||||
{
|
||||
SqlStageExecution.setReuseTableScanMappingIdStatus(this);
|
||||
return stageState.setIf(ABORTED, currentState -> !currentState.isDone());
|
||||
}
|
||||
|
||||
public boolean transitionToFailed(Throwable throwable)
|
||||
{
|
||||
requireNonNull(throwable, "throwable is null");
|
||||
|
||||
SqlStageExecution.setReuseTableScanMappingIdStatus(this);
|
||||
failureCause.compareAndSet(null, Failures.toFailure(throwable));
|
||||
boolean failed = stageState.setIf(FAILED, currentState -> !currentState.isDone());
|
||||
if (failed) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue