Skip to content
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

Cleanups #21171

Merged
merged 2 commits into from
Mar 20, 2024
Merged

Cleanups #21171

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions core/trino-main/src/main/java/io/trino/execution/SqlTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,9 @@ else if (newState.isDone()) {
switch (newState) {
// don't close buffers for a failed query
// closed buffers signal to upstream tasks that everything finished cleanly
case FAILED, FAILING, ABORTED, ABORTING ->
outputBuffer.abort();
case FINISHED, CANCELED, CANCELING ->
outputBuffer.destroy();
default ->
throw new IllegalStateException(format("Invalid state for output buffer destruction: %s", newState));
case FAILED, FAILING, ABORTED, ABORTING -> outputBuffer.abort();
case FINISHED, CANCELED, CANCELING -> outputBuffer.destroy();
default -> throw new IllegalStateException(format("Invalid state for output buffer destruction: %s", newState));
}
}
}
Expand Down Expand Up @@ -372,15 +369,13 @@ else if (taskHolder.getTaskExecution() != null) {
fullGcTime = taskContext.getFullGcTime();
dynamicFiltersVersion = taskContext.getDynamicFiltersVersion();
}
else {
if (state == FINISHED) {
// if task FINISHED successfully but taskHolder is not yet updated with SqlTaskExecution or FinalTaskInfo
// we are masking the state and return RUNNING. This is important so coordinator would not consider incomplete
// task information (e.g. missing proper dynamicFiltersVersion as final).
// This covers only short time window between call to SqlTaskExecution.start() and updating taskHolder reference in tryCreateSqlTaskExecution,
// so it will not add any noticable delays.
state = RUNNING;
}
else if (state == FINISHED) {
// if task FINISHED successfully but taskHolder is not yet updated with SqlTaskExecution or FinalTaskInfo
// we are masking the state and return RUNNING. This is important so coordinator would not consider incomplete
// task information (e.g. missing proper dynamicFiltersVersion as final).
// This covers only short time window between call to SqlTaskExecution.start() and updating taskHolder reference in tryCreateSqlTaskExecution,
// so it will not add any noticable delays.
state = RUNNING;
}

return new TaskStatus(
Expand Down
Loading