Optimize used segment fetching in Kill tasks#15107
Merged
AmatyaAvadhanula merged 6 commits intoapache:masterfrom Oct 9, 2023
Merged
Optimize used segment fetching in Kill tasks#15107AmatyaAvadhanula merged 6 commits intoapache:masterfrom
AmatyaAvadhanula merged 6 commits intoapache:masterfrom
Conversation
abhishekagarwal87
approved these changes
Oct 7, 2023
kfaraz
reviewed
Oct 8, 2023
| final Set<Map<String, Object>> usedSegmentLoadSpecs = toolbox | ||
| .getTaskActionClient() | ||
| .submit(new RetrieveUsedSegmentsAction(getDataSource(), getInterval(), null, Segments.INCLUDING_OVERSHADOWED)) | ||
| .submit(new RetrieveUsedSegmentsAction( |
Contributor
There was a problem hiding this comment.
Format: would be easier to read if the unused intervals were pre-constructed and the constructor was moved to a new line.
Suggested change
| .submit(new RetrieveUsedSegmentsAction( | |
| .submit( | |
| new RetrieveUsedSegmentsAction(getDataSource(), null, unusedIntervals, Segments.INCLUDING_OVERSHADOWED) | |
| ) |
Comment on lines
+248
to
+249
| .filter(unusedSegment -> !usedSegmentLoadSpecs.contains(unusedSegment.getLoadSpec()) | ||
| || unusedSegment.getLoadSpec() == null) |
Contributor
There was a problem hiding this comment.
unusedSegment.getLoadSpec() == null should be checked first IMO.
| @JsonCreator | ||
| public Stats( | ||
| @JsonProperty("numSegmentsKilled") int numSegmentsKilled, | ||
| @JsonProperty("numSegmentsKilledInDeepStorage") int numSegmentsKilledInDeepStorage, |
Contributor
There was a problem hiding this comment.
Why add this property too? This is a user-facing property.
Contributor
Author
There was a problem hiding this comment.
I had added it to test the changes. I can remove it if it is unnecessary in the report
Contributor
There was a problem hiding this comment.
lets remove it please. we will add it later if its needed.
ektravel
pushed a commit
to ektravel/druid
that referenced
this pull request
Oct 16, 2023
* Optimize used segment fetching in Kill tasks
10 tasks
CaseyPan
pushed a commit
to CaseyPan/druid
that referenced
this pull request
Nov 17, 2023
* Optimize used segment fetching in Kill tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#14407 - introduced a change in the behaviour of kill tasks to fetch used specs to prevent used load specs from being killed.
However there could be a significant overhead when this is done for each batch. This PR aims to optimize it.
The preliminary approach taken in this PR is to only fetch those used segments belonging to the intervals corresponding to the unused segments in a given batch.
This PR has: