-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix][broker] Fix cluster level OffloadedReadPriority to bookkeeper-first does not work #24151
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][broker] Fix cluster level OffloadedReadPriority to bookkeeper-first does not work #24151
Conversation
|
@hangc0276 Please add the following content to your PR description and select a checkbox: |
…iority_do_not_work
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## master #24151 +/- ##
=============================================
- Coverage 73.57% 39.17% -34.40%
+ Complexity 32624 12646 -19978
=============================================
Files 1877 1807 -70
Lines 139502 143089 +3587
Branches 15299 16591 +1292
=============================================
- Hits 102638 56055 -46583
- Misses 28908 79636 +50728
+ Partials 7956 7398 -558
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…irst does not work (#24151) ### Motivation When we set cluster level `managedLedgerDataReadPriority` to `bookkeeper-first` in conf/broker.conf https://github.com/apache/pulsar/blob/f2618c15bb5a9f3fcb577068584df5d0e2e4f335/conf/broker.conf#L1262-L1264 Then use the command `bin/pulsar-admin namespaces set-offload-threshold -s 0 <namespace>` to set the offload threshold in namespace level to trigger topic offload automatically. However, the broker side will create an empty OffloadPolicy when setting the offload threshold https://github.com/apache/pulsar/blob/f2618c15bb5a9f3fcb577068584df5d0e2e4f335/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java#L2174-L2176 However, the empty OffloadPolicy will set the `OffloadedReadPriority` to `TIERED_STORAGE_FIRST` in namespace level. https://github.com/apache/pulsar/blob/f2618c15bb5a9f3fcb577068584df5d0e2e4f335/pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/OffloadPoliciesImpl.java#L98-L99 The namespace level offload policy has higher priority than broker level offload policy, and it makes setting broker-level `OffloadedReadPriority` to `bookkeeper-first` doesn't work ### Modifications Change OffloadPolicy's default OffloadedReadPriority to `null` to allow broker-level offload policy can take affect. (cherry picked from commit 153fce9)
…irst does not work (#24151) ### Motivation When we set cluster level `managedLedgerDataReadPriority` to `bookkeeper-first` in conf/broker.conf https://github.com/apache/pulsar/blob/f2618c15bb5a9f3fcb577068584df5d0e2e4f335/conf/broker.conf#L1262-L1264 Then use the command `bin/pulsar-admin namespaces set-offload-threshold -s 0 <namespace>` to set the offload threshold in namespace level to trigger topic offload automatically. However, the broker side will create an empty OffloadPolicy when setting the offload threshold https://github.com/apache/pulsar/blob/f2618c15bb5a9f3fcb577068584df5d0e2e4f335/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java#L2174-L2176 However, the empty OffloadPolicy will set the `OffloadedReadPriority` to `TIERED_STORAGE_FIRST` in namespace level. https://github.com/apache/pulsar/blob/f2618c15bb5a9f3fcb577068584df5d0e2e4f335/pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/OffloadPoliciesImpl.java#L98-L99 The namespace level offload policy has higher priority than broker level offload policy, and it makes setting broker-level `OffloadedReadPriority` to `bookkeeper-first` doesn't work ### Modifications Change OffloadPolicy's default OffloadedReadPriority to `null` to allow broker-level offload policy can take affect. (cherry picked from commit 153fce9)
…irst does not work (apache#24151) ### Motivation When we set cluster level `managedLedgerDataReadPriority` to `bookkeeper-first` in conf/broker.conf https://github.com/apache/pulsar/blob/f2618c15bb5a9f3fcb577068584df5d0e2e4f335/conf/broker.conf#L1262-L1264 Then use the command `bin/pulsar-admin namespaces set-offload-threshold -s 0 <namespace>` to set the offload threshold in namespace level to trigger topic offload automatically. However, the broker side will create an empty OffloadPolicy when setting the offload threshold https://github.com/apache/pulsar/blob/f2618c15bb5a9f3fcb577068584df5d0e2e4f335/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java#L2174-L2176 However, the empty OffloadPolicy will set the `OffloadedReadPriority` to `TIERED_STORAGE_FIRST` in namespace level. https://github.com/apache/pulsar/blob/f2618c15bb5a9f3fcb577068584df5d0e2e4f335/pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/OffloadPoliciesImpl.java#L98-L99 The namespace level offload policy has higher priority than broker level offload policy, and it makes setting broker-level `OffloadedReadPriority` to `bookkeeper-first` doesn't work ### Modifications Change OffloadPolicy's default OffloadedReadPriority to `null` to allow broker-level offload policy can take affect. (cherry picked from commit 153fce9) (cherry picked from commit 02257c8)
…irst does not work (apache#24151) ### Motivation When we set cluster level `managedLedgerDataReadPriority` to `bookkeeper-first` in conf/broker.conf https://github.com/apache/pulsar/blob/f2618c15bb5a9f3fcb577068584df5d0e2e4f335/conf/broker.conf#L1262-L1264 Then use the command `bin/pulsar-admin namespaces set-offload-threshold -s 0 <namespace>` to set the offload threshold in namespace level to trigger topic offload automatically. However, the broker side will create an empty OffloadPolicy when setting the offload threshold https://github.com/apache/pulsar/blob/f2618c15bb5a9f3fcb577068584df5d0e2e4f335/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java#L2174-L2176 However, the empty OffloadPolicy will set the `OffloadedReadPriority` to `TIERED_STORAGE_FIRST` in namespace level. https://github.com/apache/pulsar/blob/f2618c15bb5a9f3fcb577068584df5d0e2e4f335/pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/OffloadPoliciesImpl.java#L98-L99 The namespace level offload policy has higher priority than broker level offload policy, and it makes setting broker-level `OffloadedReadPriority` to `bookkeeper-first` doesn't work ### Modifications Change OffloadPolicy's default OffloadedReadPriority to `null` to allow broker-level offload policy can take affect. (cherry picked from commit 153fce9) (cherry picked from commit 02257c8)
…irst does not work (apache#24151) ### Motivation When we set cluster level `managedLedgerDataReadPriority` to `bookkeeper-first` in conf/broker.conf https://github.com/apache/pulsar/blob/f2618c15bb5a9f3fcb577068584df5d0e2e4f335/conf/broker.conf#L1262-L1264 Then use the command `bin/pulsar-admin namespaces set-offload-threshold -s 0 <namespace>` to set the offload threshold in namespace level to trigger topic offload automatically. However, the broker side will create an empty OffloadPolicy when setting the offload threshold https://github.com/apache/pulsar/blob/f2618c15bb5a9f3fcb577068584df5d0e2e4f335/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java#L2174-L2176 However, the empty OffloadPolicy will set the `OffloadedReadPriority` to `TIERED_STORAGE_FIRST` in namespace level. https://github.com/apache/pulsar/blob/f2618c15bb5a9f3fcb577068584df5d0e2e4f335/pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/OffloadPoliciesImpl.java#L98-L99 The namespace level offload policy has higher priority than broker level offload policy, and it makes setting broker-level `OffloadedReadPriority` to `bookkeeper-first` doesn't work ### Modifications Change OffloadPolicy's default OffloadedReadPriority to `null` to allow broker-level offload policy can take affect.
Fixes #xyz
Main Issue: #xyz
PIP: #xyz
Motivation
When we set cluster level
managedLedgerDataReadPrioritytobookkeeper-firstin conf/broker.confpulsar/conf/broker.conf
Lines 1262 to 1264 in f2618c1
Then use the command
bin/pulsar-admin namespaces set-offload-threshold -s 0 <namespace>to set the offload threshold in namespace level to trigger topic offload automatically.However, the broker side will create an empty OffloadPolicy when setting the offload threshold
pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java
Lines 2174 to 2176 in f2618c1
However, the empty OffloadPolicy will set the
OffloadedReadPrioritytoTIERED_STORAGE_FIRSTin namespace level.pulsar/pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/OffloadPoliciesImpl.java
Lines 98 to 99 in f2618c1
The namespace level offload policy has higher priority than broker level offload policy, and it makes setting broker-level
OffloadedReadPrioritytobookkeeper-firstdoesn't workModifications
Change OffloadPolicy's default OffloadedReadPriority to
nullto allow broker-level offload policy can take affect.Verifying this change
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: