-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Do not compare finished and all tasks sets eagerly #14635
Changes from all commits
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 |
---|---|---|
|
@@ -60,6 +60,7 @@ | |
import java.util.stream.Stream; | ||
|
||
import static com.google.common.base.Preconditions.checkArgument; | ||
import static com.google.common.base.Preconditions.checkState; | ||
import static com.google.common.collect.ImmutableList.toImmutableList; | ||
import static com.google.common.collect.ImmutableSet.toImmutableSet; | ||
import static io.airlift.http.client.HttpUriBuilder.uriBuilderFrom; | ||
|
@@ -395,7 +396,11 @@ private synchronized boolean isStageFlushing() | |
|
||
private synchronized boolean isStageFinished() | ||
{ | ||
return finishedTasks.containsAll(allTasks); | ||
boolean finished = finishedTasks.size() == allTasks.size(); | ||
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. If we are 100% sure that 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.
That would be a bug |
||
if (finished) { | ||
checkState(finishedTasks.containsAll(allTasks), "Finished tasks should contain all tasks"); | ||
} | ||
return finished; | ||
} | ||
|
||
private boolean addFlushingTask(TaskId taskId) | ||
|
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.
Can we do similar optimization in isStageFlushing ?
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.
isStageFlushing
we check two different sets. There is a high chance that flushing size and finished size will be higher thanallTask
size (first we add to finished, and then we remove from flushing).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.
Right, if we can have a task id in both sets at some point in time, then we can't make similar optimization there.