GrantPSpencer opened a new pull request, #2969:
URL: https://github.com/apache/helix/pull/2969

   ### Issues
   
   - [ ] My PR addresses the following Helix issues and references them in the 
PR description:
   NPE occurs for first WAGED resource in cluster after previous WAGED 
resources have been removed
   #2891 
   
   ### Description
   
   - [ ] Here are some details about my PR, including screenshots of any UI 
changes:
   
   Full description of the NPE can be found in the issue #2891. Here is a brief 
summary:
   1. `_instanceCapacityMap` is calculated with WAGED resources in cluster
   2. If you remove all WAGED resources, the previous `_instanceCapacityMap` is 
still present. This is only recalculated under certain conditions
   3. If you add a new WAGED resource, the `_instanceCapacityMap` is not 
recalculated before it is used. This stale `_instanceCapacityMap` can lead to 
an NPE
   
   This 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:
   ```
   $ mvn test -o -Dtest=TestWagedNPE -pl=helix-core
   
   [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 
11.836 s - in org.apache.helix.integration.TestWagedNPE
   [INFO] 
------------------------------------------------------------------------
   [INFO] BUILD SUCCESS
   [INFO] 
------------------------------------------------------------------------
   [INFO] Total time:  35.815 s
   [INFO] Finished at: 2024-11-25T10:09:46-08:00
   [INFO] 
------------------------------------------------------------------------
   
   ```
   
   (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)
   
   - My PR contains changes that break backward compatibility or previous 
assumptions for certain methods or API. They include:
   N/A
   
   ### Commits
   
   - My commits all reference appropriate Apache Helix GitHub issues in their 
subject lines. In addition, my commits follow the guidelines from "[How to 
write a good git commit message](http://chris.beams.io/posts/git-commit/)":
     1. Subject is separated from body by a blank line
     1. Subject is limited to 50 characters (not including Jira issue reference)
     1. Subject does not end with a period
     1. Subject uses the imperative mood ("add", not "adding")
     1. Body wraps at 72 characters
     1. Body explains "what" and "why", not "how"
   
   ### Code Quality
   
   - My diff has been formatted using helix-style.xml 
   (helix-style-intellij.xml if IntelliJ IDE is used)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to