Repository navigation
HDDS-16751. Fix possible NullPointerException in KeyInputStream#getBlockLocationInfo during block location refresh - #11435
Open
cchung100m wants to merge 2 commits into
Open
cchung100m wants to merge 2 commits into
cchung100m wants to merge 2 commits into
Conversation
…ockLocationInfo during block location refresh
Contributor
|
I'd add extra unit tests to cover new branches |
Contributor
Author
|
Hi @yandrey321 |
cchung100m
marked this pull request as ready for review
October 8, 2026 05:28
Contributor
Author
peterxcli
reviewed
Oct 8, 2026
peterxcli
left a comment
Member
There was a problem hiding this comment.
thinking instead of adding these null check, is it possible to refactor the code so we dont need them?
| } | ||
|
|
||
| private static BlockLocationInfo getBlockLocationInfo(OmKeyInfo newKeyInfo, | ||
| @VisibleForTesting |
Member
There was a problem hiding this comment.
I think we no longer suggest adding @VisibleForTesting, but I forgot the actual reason. at least getter is harmless
Suggested change
| @VisibleForTesting |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changes were proposed in this pull request?
This PR adds null checks to
KeyInputStream#getBlockLocationInfo, so the block-location refresh returns null instead of throwing aNullPointerExceptionwhen the refreshed key info or its latest version locations are null, whichBlockExtendedInputStream#refershBlockInfoalready handles by logging a warning and continuing with the retry policy. The method is now package-private (@VisibleForTesting), and a new unit test, TestKeyInputStream, covers the null key info, missing location versions, and normal lookup cases.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-16751
How was this patch tested?
Existing unit and integration tests