Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 6 additions & 3 deletions presto-native-execution/presto_cpp/main/PrestoTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,12 @@ uint64_t PrestoTask::timeSinceLastHeartbeatMs() const {
}

protocol::TaskStatus PrestoTask::updateStatusLocked() {
if (!taskStarted) {
info.taskStatus.state = protocol::TaskState::RUNNING;
return info.taskStatus;
if (!taskStarted and error == nullptr) {
protocol::TaskStatus ret = info.taskStatus;
if (ret.state != protocol::TaskState::ABORTED) {
ret.state = protocol::TaskState::PLANNED;
}
return ret;
}

// Error occurs when creating task or even before task is created. Set error
Expand Down
7 changes: 7 additions & 0 deletions presto-native-execution/presto_cpp/main/PrestoTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,14 @@ struct ResultRequest {
struct PrestoTask {
const PrestoTaskId id;
std::shared_ptr<velox::exec::Task> task;

// Has the task been normally created and started.
// When you create task with error - it has never been started.
// When you create task from 'delete task' - it has never been started.
// When you create task from any other endpoint, such as 'get result' - it has
// not been started, until the actual 'create task' message comes.
bool taskStarted{false};

uint64_t lastHeartbeatMs{0};
mutable std::mutex mutex;

Expand Down
2 changes: 0 additions & 2 deletions presto-native-execution/presto_cpp/main/TaskManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,6 @@ std::unique_ptr<TaskInfo> TaskManager::createOrUpdateErrorTask(
}
prestoTask->info.needsPlan = false;
}
// outside of prestoTask->mutex.
prestoTask->taskStarted = true;

auto info = prestoTask->updateInfo();
return std::make_unique<TaskInfo>(info);
Expand Down