You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NPE occurring due to null value returned from partitionMap, likely from a disabled instance having task current state causing mismatch in map keys. Current logic makes assumption that additionPartitionMap.keySet() == partitionMap.keySet()
Description
Here are some details about my PR, including screenshots of any UI changes:
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":
Subject is separated from body by a blank line
Subject is limited to 50 characters (not including Jira issue reference)
Subject does not end with a period
Subject uses the imperative mood ("add", not "adding")
Body wraps at 72 characters
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)
Pull request approved by: @xyuanlu
Commit message: This PR fixes an NPE in task pipeline caused by a difference in map keyset. In fillActiveTaskCount(..) we iterate over the keyset of one map, but then call .get(key) on a 2nd map. This works on the assumption that the two maps will have the same keyset. The map we get the keys from is built from nodes with task current states and the other is from live and enabled nodes. If there is a node with a current state but has been disabled, then there will be key mismatch and a null value will be returned, which we then attempt to perform arithmetic on (+ operator) and get an NPE. Interestingly, this can only occur after a controller reset as it needs the 2nd map keys to be cleared and repopulated without the disabled node. This fix adds a default get value of 0 to both get operations to prevent any NPEs
This file contains hidden or 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
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 occurring in task pipeline if disabled instance has task current state #3079
NPE occurring due to null value returned from partitionMap, likely from a disabled instance having task current state causing mismatch in map keys. Current logic makes assumption that
additionPartitionMap.keySet()==partitionMap.keySet()Description
Change map.get to .getOrDefault to prevent NPEs
Tests
N/A
Commits
Code Quality
(helix-style-intellij.xml if IntelliJ IDE is used)