-
Notifications
You must be signed in to change notification settings - Fork 0
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
Implement the WAGED rebalance with delayed rebalance logic. #1
Conversation
@@ -41,18 +60,279 @@ | |||
public class WagedRebalancer implements GlobalRebalancer<ResourceControllerDataProvider> { | |||
private static final Logger LOG = LoggerFactory.getLogger(WagedRebalancer.class); | |||
|
|||
// When any of the following change happens, the rebalancer needs to do a global rebalance. | |||
private static final Set<HelixConstants.ChangeType> GLOBAL_REBALANCE_REQUIRED_CHANGE_TYPES = | |||
Collections.unmodifiableSet(new HashSet<>(Arrays |
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.
Use ImmutableSet.of
private AssignmentMetadataStore _assignmentMetadataStore; | ||
private RebalanceAlgorithm _rebalanceAlgorithm; | ||
private MappingCalculator<ResourceControllerDataProvider> _mappingCalculator; | ||
|
||
@Override | ||
public void init() { |
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.
I don't think the init method is necessary. If the class is stateless we can create singleton instance. A constructor will give you the ability to mock the dependency for unit testing
public Map<String, IdealState> computeNewIdealStates(ResourceControllerDataProvider clusterData, | ||
Map<String, Resource> resourceMap, final CurrentStateOutput currentStateOutput) { | ||
return new HashMap<>(); | ||
public Map<String, IdealState> computeNewIdealStates(ResourceControllerDataProvider dataProvider, |
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.
The public method and the related private methods are too long and unbelievably difficult to understand and maintain
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.
I have divided the PR to 2 pieces. But in general, this logic is one of the most complicated ones in our project. That's why we need to start early.
And, believe me, split them into sub methods won't help with readability...
Please try to understand what we are doing and comment with detail if you think any part can be simplified.
da7c513
to
9ca65c1
Compare
a507dc8
to
91456f8
Compare
9ca65c1
to
7944e7f
Compare
Note this implementation does not contain delayed rebalance logic. Unit test to be added.
7944e7f
to
8639c03
Compare
Issues
apache#402
Description
This PR implements the WAGED rebalancer.
Delayed rebalance logic will be integrated with the WAGED rebalancer later.
Tests
TBD
TBD
Commits
Documentation
https://github.com/apache/helix/wiki/Weight-aware-Globally-Evenly-distributed-Rebalancer
Code Quality