[fix] Fix NPE in StreamOp.fetchExistingTotalDocs when exceptions array is present#18491
Open
Akanksha-kedia wants to merge 1 commit into
Open
[fix] Fix NPE in StreamOp.fetchExistingTotalDocs when exceptions array is present#18491Akanksha-kedia wants to merge 1 commit into
Akanksha-kedia wants to merge 1 commit into
Conversation
…resent
The exceptions field in the broker query response is a JSON array, so
calling exceptions.get("errorCode") on an ArrayNode always returns null,
causing a NullPointerException. Fix by indexing into the first element.
Also treat BROKER_SEGMENT_UNAVAILABLE (305) as a transient condition
(segments still loading after rolling upgrade) and return 0 to allow the
caller's retry loop to continue, consistent with BROKER_INSTANCE_MISSING.
Contributor
Author
|
@noob-se7en please review |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #18491 +/- ##
============================================
+ Coverage 63.68% 63.70% +0.01%
Complexity 1685 1685
============================================
Files 3266 3266
Lines 199821 199821
Branches 31022 31022
============================================
+ Hits 127257 127294 +37
+ Misses 62425 62394 -31
+ Partials 10139 10133 -6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Description
Fix a
NullPointerExceptioninStreamOp.fetchExistingTotalDocsthat occurs when the broker response contains a non-emptyexceptionsarray.Fixes #18490
Root Cause
The
exceptionsfield in the broker query response is a JSON array ([{"errorCode": 410, ...}]), but the code was callingexceptions.get("errorCode")as if it were a JSON object. Jackson'sArrayNode.get(String)always returnsnull, so the subsequenterrorCode.asInt()throws an NPE.Changes Made
exceptions.get(0)first, then extracterrorCodefrom the first exception objectBROKER_INSTANCE_MISSINGhandlingTesting Done
mvn spotless:checkpasses forpinot-compatibility-verifierChecklist