Skip to content

Commit

Permalink
Create TaskStatus before stats when reporting taskInfo to coordinator
Browse files Browse the repository at this point in the history
Task may have its stats populated and state updated to FINISHED during
the createTaskInfo() call, which could potentially create TaskInfo with
FINISHED state, but with some of the stats missing.
Creating TaskStatus first makes sure that stats are already present.

This handles a rare case of flaky tests reported in #5172
  • Loading branch information
atanasenko authored and sopel39 committed Nov 9, 2021
1 parent ba77719 commit 8708cd7
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,11 @@ private static Set<PlanNodeId> getNoMoreSplits(TaskHolder taskHolder)

private TaskInfo createTaskInfo(TaskHolder taskHolder)
{
// create task status first to prevent potentially seeing incomplete stats for a done task state
TaskStatus taskStatus = createTaskStatus(taskHolder);
TaskStats taskStats = getTaskStats(taskHolder);
Set<PlanNodeId> noMoreSplits = getNoMoreSplits(taskHolder);

TaskStatus taskStatus = createTaskStatus(taskHolder);
return new TaskInfo(
taskStatus,
lastHeartbeat.get(),
Expand Down

0 comments on commit 8708cd7

Please sign in to comment.