-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Support async commit for ExchangeSink #10699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7d63de2
7bb882f
7c7fbd1
015a3cc
9419f33
ef157d2
1e6cbde
12ede0b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,6 +38,7 @@ | |
| import io.trino.operator.StageExecutionDescriptor; | ||
| import io.trino.operator.TaskContext; | ||
| import io.trino.spi.SplitWeight; | ||
| import io.trino.spi.TrinoException; | ||
| import io.trino.sql.planner.LocalExecutionPlanner.LocalExecutionPlan; | ||
| import io.trino.sql.planner.plan.PlanNodeId; | ||
|
|
||
|
|
@@ -76,6 +77,7 @@ | |
| import static io.trino.execution.SqlTaskExecution.SplitsState.FINISHED; | ||
| import static io.trino.execution.SqlTaskExecution.SplitsState.NO_MORE_SPLITS; | ||
| import static io.trino.operator.PipelineExecutionStrategy.UNGROUPED_EXECUTION; | ||
| import static io.trino.spi.StandardErrorCode.GENERIC_INTERNAL_ERROR; | ||
| import static java.lang.String.format; | ||
| import static java.util.Objects.requireNonNull; | ||
| import static java.util.function.Function.identity; | ||
|
|
@@ -639,14 +641,28 @@ private synchronized void checkTaskCompletion() | |
| // no more output will be created | ||
| outputBuffer.setNoMorePages(); | ||
|
|
||
| // are there still pages in the output buffer | ||
| if (!outputBuffer.isFinished()) { | ||
| BufferState bufferState = outputBuffer.getState(); | ||
| if (!bufferState.isTerminal()) { | ||
| taskStateMachine.transitionToFlushing(); | ||
| return; | ||
| } | ||
|
|
||
| // Cool! All done! | ||
| taskStateMachine.finished(); | ||
| if (bufferState == BufferState.FINISHED) { | ||
| // Cool! All done! | ||
| taskStateMachine.finished(); | ||
| return; | ||
| } | ||
|
|
||
| if (bufferState == BufferState.FAILED) { | ||
| Throwable failureCause = outputBuffer.getFailureCause() | ||
| .orElseGet(() -> new TrinoException(GENERIC_INTERNAL_ERROR, "Output buffer is failed but the failure cause is missing")); | ||
| taskStateMachine.failed(failureCause); | ||
| return; | ||
| } | ||
|
|
||
| // The only terminal state that remains is ABORTED. | ||
| // Buffer is expected to be aborted only if the task itself is aborted. In this scenario the following statement is expected to be noop. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
why? because task is aborted so this line should never execute?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Failing an aborted task is a noop, as the |
||
| taskStateMachine.failed(new TrinoException(GENERIC_INTERNAL_ERROR, "Unexpected buffer state: " + bufferState)); | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -1111,7 +1127,7 @@ public CheckTaskCompletionOnBufferFinish(SqlTaskExecution sqlTaskExecution) | |
| @Override | ||
| public void stateChanged(BufferState newState) | ||
| { | ||
| if (newState == BufferState.FINISHED) { | ||
| if (newState.isTerminal()) { | ||
| SqlTaskExecution sqlTaskExecution = sqlTaskExecutionReference.get(); | ||
| if (sqlTaskExecution != null) { | ||
| sqlTaskExecution.checkTaskCompletion(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about
ABORTEDwhy is it not expected here? Worth a comment?