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.
Issues
Failing tests in CI:
#2901
#2902
Description
From #2877 , autoRebalanceStrategy now reads the idealState and StateModelDefinition from the cache. This causes an NPE when computing the potential assignment.
getIdealAssignmentForFullAuto
instantiates a cache (ResourceControllerDataProvider
) and only instantiates the necessary values. I'm assuming this was done as an optimization and to avoid a full cache refresh. My change adds the other necessary fields to the cache for the calculation to complete. It's also possible to fully reresh the cache, but I believe this would require changing public constructors in order to pass the accessor down to the relevant method.Here is the NPE trace:
Code changes:
helix-core/src/main/java/org/apache/helix/controller/dataproviders/BaseControllerDataProvider.java
: Added a new methodsetStateModelDefMap
to allow manually setting the cache's state model definition map.helix-core/src/main/java/org/apache/helix/util/HelixUtil.java
: Modified the initialization ofResourceControllerDataProvider
to include setting the state model definition map and ideal states, which are now necesasry fieldsTests
N/A
Test passes on this branch:
Test will fail on current master:
Changes that Break Backward Compatibility (Optional)
N/A
Commits
Code Quality
(helix-style-intellij.xml if IntelliJ IDE is used)