-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
clean up the balancing code around the batched vs deprecated way of sampling segments to balance #11960
Merged
jihoonson
merged 10 commits into
apache:master
from
capistrant:batch-segment-sampler-fix
Dec 7, 2021
Merged
clean up the balancing code around the batched vs deprecated way of sampling segments to balance #11960
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0927377
clean up the balancing code around the batched vs deprecated way of s…
capistrant 44a66bb
fix docs, clarify comments, add deprecated annotations to legacy code
capistrant 755b316
remove unused variable
capistrant 4804810
Merge branch 'master' into batch-segment-sampler-fix
capistrant 92b532b
update dynamic config dialog in console to state percentOfSegmentsToC…
capistrant 1aaecfd
fix dynamic config text for percentOfSegmentsToConsiderPerMove
capistrant 3a18f27
run prettier to cleanup coordinator-dynamic-config.tsx changes
capistrant 3ca6b1e
update jest snapshot
capistrant d3e2675
Merge branch 'master' into batch-segment-sampler-fix
capistrant acfd534
update documentation per review feedback
capistrant File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,8 +56,6 @@ public class BalanceSegments implements CoordinatorDuty | |
protected final Map<String, ConcurrentHashMap<SegmentId, BalancerSegmentHolder>> currentlyMovingSegments = | ||
new HashMap<>(); | ||
|
||
private static final int DEFAULT_RESERVOIR_SIZE = 1; | ||
|
||
public BalanceSegments(DruidCoordinator coordinator) | ||
{ | ||
this.coordinator = coordinator; | ||
|
@@ -202,12 +200,21 @@ private Pair<Integer, Integer> balanceServers( | |
final int maxToLoad = params.getCoordinatorDynamicConfig().getMaxSegmentsInNodeLoadingQueue(); | ||
int moved = 0, unmoved = 0; | ||
|
||
Iterator<BalancerSegmentHolder> segmentsToMove = strategy.pickSegmentsToMove( | ||
toMoveFrom, | ||
params.getBroadcastDatasources(), | ||
params.getCoordinatorDynamicConfig().useBatchedSegmentSampler() ? maxSegmentsToMove : DEFAULT_RESERVOIR_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. I think we can delete this unused constant variable |
||
params.getCoordinatorDynamicConfig().getPercentOfSegmentsToConsiderPerMove() | ||
); | ||
Iterator<BalancerSegmentHolder> segmentsToMove; | ||
// The pick method depends on if the operator has enabled batched segment sampling in the Coorinator dynamic config. | ||
if (params.getCoordinatorDynamicConfig().useBatchedSegmentSampler()) { | ||
segmentsToMove = strategy.pickSegmentsToMove( | ||
toMoveFrom, | ||
params.getBroadcastDatasources(), | ||
maxSegmentsToMove | ||
); | ||
} else { | ||
segmentsToMove = strategy.pickSegmentsToMove( | ||
toMoveFrom, | ||
params.getBroadcastDatasources(), | ||
params.getCoordinatorDynamicConfig().getPercentOfSegmentsToConsiderPerMove() | ||
); | ||
} | ||
|
||
//noinspection ForLoopThatDoesntUseLoopVariable | ||
for (int iter = 0; (moved + unmoved) < maxSegmentsToMove; ++iter) { | ||
|
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.
Should we add a similar deprecation message in the web console description for this property?
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.
yep, good call @a2l007
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 document what the preferred alternative is here?