apache / apache/pulsar

[Bug] Fileds of OffloadPoliciesImpl managedLedgerOffloadMaxThreads & managedLedgerOffloadPrefetchRounds not matched with config file

Open
#20,734 6 comments 0 reactions 2 assignees Claimed by @Technoboy- View on GitHub
Stale type/bug
Dominant language
Java
Stars
15.3k
Forks
3.8k
Avg merge
1d 14h
Merged PRs (30d)
160

Description

### Search before asking

- [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.

### Version

latest master

### Minimal reproduce step

topicLevelPolicies/nsLevelPolicies created with deafult `managedLedgerOffloadMaxThreads=2` and `managedLedgerOffloadPrefetchRounds=1`
but the admin-api `set-offload-policies` not support adjust these two fileds. Therefore, these two parameters are always default values.
for reason: policies level priority: topic > namespace > broker
Even if we configure new values in broker.conf, they will still be overwritten by default values in ns/topic offloadpolicies when executing the merge logic.

**These two values can never be modified, which is unexpected. It is reasonable and necessary to adjust these parameter values by configuring relevant parameters in broker.conf.**

reproduce:
write a unit-test in OffloadPoliciesTest#mergeTest
set brokerOffloadMaxThreads=20
set brokerOffloadPrefetchRounds = 10
create offloadPolicies by
`OffloadPoliciesImpl offloadPolicies =
OffloadPoliciesImpl.mergeConfiguration(topicLevelPolicies, nsLevelPolicies, brokerProperties);`

### What did you expect to see?

unit passed
and
managedLedgerOffloadMaxThreads=20
managedLedgerOffloadPrefetchRounds=10

### What did you see instead?

`Assert.assertEquals(offloadPolicies.getManagedLedgerOffloadMaxThreads(), brokerOffloadMaxThreads);`
image

`Assert.assertEquals(offloadPolicies.getManagedLedgerOffloadPrefetchRounds(),brokerOffloadPrefetchRounds);`
image

### Anything else?

_No response_

### Are you willing to submit a PR?

- [X] I'm willing to submit a PR!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.