Fix waged instance capacity npe on new resource #2969
Merged
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
NPE occurs for first WAGED resource in cluster after previous WAGED resources have been removed
WagedInstanceCapacity Null Pointer Exception due to stale _instanceCapacityMap #2891
Description
Full description of the NPE can be found in the issue #2891. Here is a brief summary:
_instanceCapacityMap
is calculated with WAGED resources in cluster_instanceCapacityMap
is still present. This is only recalculated under certain conditions_instanceCapacityMap
is not recalculated before it is used. This stale_instanceCapacityMap
can lead to an NPEThis PR addresses the above issue by ensuring the
_instanceCapacityMap
is null whenever there are no WAGED resources in the cluster. This leads to the map being recalculated before it is used when a new WAGED resource is added.Tests
The following tests are written for this issue:
New test class:
TestWagedNPE
The following is the result of the "mvn test" command on the appropriate module:
(If CI test fails due to known issue, please specify the issue and test PR locally. Then copy & paste the result of "mvn test" to here.)
Changes that Break Backward Compatibility (Optional)
N/A
Commits
Code Quality
(helix-style-intellij.xml if IntelliJ IDE is used)