Jason918 opened a new pull request #13618:
URL: https://github.com/apache/pulsar/pull/13618
### Motivation
This is one of the serial topic policy optimization with
`HierarchyTopicPolicies`.
Update topic policy with HierarchyTopicPolicies comes with these benefits:
- All topic policy related settings will goes into
AbstractTopic#topicPolicies, easier to understand, check, review, and modify.
- Unify policy update to AbstractTopic. And easier to find which policy is
not applied to non-persistent topic yet. And we can easily add support for it.
- Unify policy value with 3 level settings (topic/namespace/broker), and
priority with topic > namespace > broker. And it's easier to find which level
settings is missing.
- All values are updated at creation or by trigger. We can save some
resource to update it or recalculate each time we use it.
- etc.
### Modifications
1. Add new field `maxUnackedMessagesOnConsumer` in
org.apache.pulsar.broker.service.AbstractTopic#topicPolicies.
2. change `maxUnackedMessages` to `maxUnackedMessagesEnabled` in Consumer.
`maxUnackedMessages` check is enabled only for durable cursor.
### Verifying this change
- [ ] Make sure that the change passes the CI checks.
This change is already covered by existing tests, such as
- org.apache.pulsar.broker.admin.AdminApiMaxUnackedMessages
Some checklist for updating topic policy with `HierarchyTopicPolicies`.
- [x] Broker level value set. And if it's dynamic (no).
- [x] Namespace level value updated.
- [x] Topic level value updated.
- [x] Pre-existing unit test covers this change and updated to verify this
change.
### Does this pull request potentially affect one of the following parts:
*If `yes` was chosen, please highlight the changes*
- Dependencies (does it add or upgrade a dependency): (no)
- The public API: (no)
- The schema: (no)
- The default values of configurations: (no)
- The wire protocol: (no)
- The rest endpoints: (no)
- The admin cli options: (no)
- Anything that affects deployment: (no)
### Documentation
Check the box below and label this PR (if you have committer privilege).
Need to update docs?
- [x] `no-need-doc`
Code optimization.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]