You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by "desaikomal (via GitHub)" <gi...@apache.org> on 2023/10/18 03:53:19 UTC
[PR] [WIP] Fix NPE in intermediate state calculation stage [helix]
desaikomal opened a new pull request, #2668:
URL: https://github.com/apache/helix/pull/2668
### Issues
- [ ] My PR addresses the following Helix issues and references them in the PR description:
### Description
- [x] Here are some details about my PR, including screenshots of any UI changes:
Helix Pipeline failed in IntermediateStateCalc stage as user reduced the NUM_PARTITION in IdealState which resulted in deletion of partition from partitionMap for the resource.
IntermediateStateCalc always assumes that prefereneList for partition is either empty or populated but with possible recent changes with WAGED n - n+1.
Fixing the NPE and skipping the checks for size/null for preferenceList.
### Tests
- [x ] The following tests are written for this issue:
TestIntermediateStateCalcStage::testPartitionMissing
(List the names of added unit/integration tests)
- The following is the result of the "mvn test" command on the appropriate module:
this is WIP.
(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:
(Consider including all behavior changes for public methods or API. Also include these changes in merge description so that other developers are aware of these changes. This allows them to make relevant code changes in feature branches accounting for the new method/API behavior.)
### Documentation (Optional)
- In case of new functionality, my PR adds documentation in the following wiki page:
(Link the GitHub wiki you added)
### 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: reviews-unsubscribe@helix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
Re: [PR] [WIP] Fix NPE in intermediate state calculation stage [helix]
Posted by "desaikomal (via GitHub)" <gi...@apache.org>.
desaikomal commented on code in PR #2668:
URL: https://github.com/apache/helix/pull/2668#discussion_r1364634209
##########
helix-core/src/main/java/org/apache/helix/controller/stages/IntermediateStateCalcStage.java:
##########
@@ -367,6 +367,9 @@ private PartitionStateMap computeIntermediatePartitionState(ResourceControllerDa
currentStateOutput.getCurrentStateMap(resourceName, partition).entrySet().stream()
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
List<String> preferenceList = preferenceLists.get(partition.getPartitionName());
+ if (preferenceList == null || preferenceList.size() == 0) {
+ continue;
Review Comment:
On line: 363, i saw that we used "continue" and that's why i added continue here. But let me do another change for this as it has been merged.
--
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: reviews-unsubscribe@helix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
Re: [PR] [WIP] Fix NPE in intermediate state calculation stage [helix]
Posted by "xyuanlu (via GitHub)" <gi...@apache.org>.
xyuanlu merged PR #2668:
URL: https://github.com/apache/helix/pull/2668
--
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: reviews-unsubscribe@helix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
Re: [PR] [WIP] Fix NPE in intermediate state calculation stage [helix]
Posted by "desaikomal (via GitHub)" <gi...@apache.org>.
desaikomal commented on PR #2668:
URL: https://github.com/apache/helix/pull/2668#issuecomment-1769054737
This PR is ready to be merged. Thank @xyuanlu for the review.
Merge message: Fix the NPE in intermediate state calcuation stage when a partition is deleted through update in NUM_PARTITION field.
--
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: reviews-unsubscribe@helix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org
Re: [PR] [WIP] Fix NPE in intermediate state calculation stage [helix]
Posted by "junkaixue (via GitHub)" <gi...@apache.org>.
junkaixue commented on code in PR #2668:
URL: https://github.com/apache/helix/pull/2668#discussion_r1364311182
##########
helix-core/src/main/java/org/apache/helix/controller/stages/IntermediateStateCalcStage.java:
##########
@@ -367,6 +367,9 @@ private PartitionStateMap computeIntermediatePartitionState(ResourceControllerDa
currentStateOutput.getCurrentStateMap(resourceName, partition).entrySet().stream()
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
List<String> preferenceList = preferenceLists.get(partition.getPartitionName());
+ if (preferenceList == null || preferenceList.size() == 0) {
+ continue;
Review Comment:
We cannot just let continue. That means we are not restricting the throttling if preference list is null.
But the problematic code place is the use preference list as a backup replica when the number of replica is not parsable. We should pass 0, as argument for getRequiredState instead of continuing.
--
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: reviews-unsubscribe@helix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org