Commit 1594e91
[fix][broker] Fix cluster level OffloadedReadPriority to bookkeeper-first 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)1 parent 6921a49 commit 1594e91
File tree
2 files changed
+12
-2
lines changed- pulsar-common/src
- main/java/org/apache/pulsar/common/policies/data
- test/java/org/apache/pulsar/common/policies/data
2 files changed
+12
-2
lines changedLines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
98 | | - | |
| 97 | + | |
99 | 98 | | |
100 | 99 | | |
101 | 100 | | |
| |||
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
472 | 474 | | |
473 | 475 | | |
474 | 476 | | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
475 | 486 | | |
0 commit comments