-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix][admin] Fix NPE when get OffloadThreshold
on namespace.
#18061
Conversation
Codecov Report
@@ Coverage Diff @@
## master #18061 +/- ##
=============================================
+ Coverage 34.91% 46.80% +11.88%
- Complexity 5707 17880 +12173
=============================================
Files 607 1574 +967
Lines 53396 128311 +74915
Branches 5712 14113 +8401
=============================================
+ Hits 18644 60054 +41410
- Misses 32119 62085 +29966
- Partials 2633 6172 +3539
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -2054,7 +2054,8 @@ public void getOffloadThreshold( | |||
validateNamespacePolicyOperationAsync(namespaceName, PolicyName.OFFLOAD, PolicyOperation.READ) | |||
.thenCompose(__ -> getNamespacePoliciesAsync(namespaceName)) | |||
.thenAccept(policies -> { | |||
if (policies.offload_policies == null) { | |||
if (policies.offload_policies == null | |||
|| policies.offload_policies.getManagedLedgerOffloadThresholdInBytes() == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's weird why the DEFAULT_OFFLOAD_THRESHOLD_IN_BYTES
is null. But I think it's better to use this constant.
(cherry picked from commit 8f44c1a)
Fixes #18023
Motivation
If the namespace policy inits without setting
managedLedgerOffloadThresholdInBytes
(like : if usersetOffloadDeletionLag
first and thengetOffloadThreshold
), it will cause NPE when getOffloadThreshold
.Documentation
doc-not-needed
Matching PR in forked repository
PR in forked repository: https://github.com/Technoboy-/pulsar/pull/12