-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix][admin] Set local policies overwrites "number of bundles" passed during namespace creation #24762
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
base: master
Are you sure you want to change the base?
[fix][admin] Set local policies overwrites "number of bundles" passed during namespace creation #24762
Conversation
… during namespace creation
@oneby-wang Please add the following content to your PR description and select a checkbox:
|
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.
From the PR description, it seems possible to add a test?
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java
Outdated
Show resolved
Hide resolved
Thanks for advice, I'll add unit tests. |
… during namespace creation
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
ExtensibleLoadManagerTest.testAntiaffinityPolicy() unit test failure in fork repository PR. Seems this default bundle config affects this unit test. Previous: static default 1 numBundles. After: namespace policies numBundles. pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java Lines 1792 to 1793 in 7c8d3c9
PoliciesUtil.defaultBundle() method. pulsar/pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/PoliciesUtil.java Lines 33 to 41 in 7c8d3c9
Seems some bugs in ExtensibleLoadManager or ExtensibleLoadManagerTest? Not familiar with ExtensibleLoadManager, may give me some entry point, may be I can help fix this problem? Seems here? pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/namespace/NamespaceService.java Lines 224 to 237 in 7c8d3c9
|
Seems the anti-affinity works at the bundle level. pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/LoadManagerShared.java Lines 588 to 620 in 7c8d3c9
I think this unit test may work in a wrong way due to this PR related issue, so I changed numBundles to 1 in createNamespace method. Lines 315 to 321 in 7c8d3c9
|
Fixes #23897
Motivation
Set local policies will overwrite "number of bundles" passed during namespace creation. If we don't call any get namespace policies operation, local policies will not be created, so it will be overwritten.
pulsar/pulsar-broker/src/main/java/org/apache/pulsar/common/naming/NamespaceBundleFactory.java
Lines 164 to 182 in 8879b3b
The following steps can reproduce the problem.
But the following steps will not reproduce the problem.
Modifications
If local policies is not present, first try to use namespace policies bundle data, then fallback to
config().getDefaultNumberOfNamespaceBundles()
Verifying this change
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: oneby-wang#5