-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix][test] NamespaceServiceTest.testSplitBundleWithHighestThroughput #16714
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][test] NamespaceServiceTest.testSplitBundleWithHighestThroughput #16714
Conversation
| public void testSplitBundleWithHighestThroughput() throws Exception { | ||
|
|
||
| conf.setLoadManagerClassName(ModularLoadManagerImpl.class.getName()); | ||
| conf.setLoadBalancerEnabled(false); |
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.
Hmmm, it's a little confusing. The test is related to the load manager but need to disable the load balancer in the test.
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.
I think without this change, the flaky test can also be fixed? Since we will not return null for method getBundleWithHighestThroughput
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.
No, disable the load balancer just to cancel the load report task.
You can see the below code, in this test, it tries to write the mock load data to storage, but if the load report task starts, the mock data might be overridden.
pulsar/pulsar-broker/src/test/java/org/apache/pulsar/broker/namespace/NamespaceServiceTest.java
Lines 625 to 634 in 0134908
| NamespaceBundle targetNamespaceBundle = bundles.findBundle(TopicName.get(topic + "0")); | |
| String bundle = targetNamespaceBundle.getBundleRange(); | |
| String path = ModularLoadManagerImpl.getBundleDataPath(namespace + "/" + bundle); | |
| NamespaceBundleStats defaultStats = new NamespaceBundleStats(); | |
| defaultStats.msgThroughputIn = 100000; | |
| defaultStats.msgThroughputOut = 100000; | |
| BundleData bd = new BundleData(10, 19, defaultStats); | |
| bd.setTopics(10); | |
| byte[] data = ObjectMapperFactory.getThreadLocal().writeValueAsBytes(bd); | |
| pulsar.getLocalMetadataStore().put(path, data, Optional.empty()); |
| NamespaceBundles bundles = getBundles(nsName); | ||
| double maxMsgThroughput = -1; | ||
| NamespaceBundle bundleWithHighestThroughput = null; | ||
| NamespaceBundle bundleWithHighestThroughput = bundles.getBundles().get(0); |
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.
I don't understand, I think even if the bundle is updated, we should always be able to find the one with the highest load?
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.
If the bundle don't have any connected topic, the check bundleData.getTopics() > 0 will never pass, so the bundleWithHighestThroughput is null.
Technoboy-
left a comment
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.
We need to discuss more about this modification, because it seems change back to #12957.
|
The pr had no activity for 30 days, mark with Stale label. |
|
@Demogorgon314 hi, I move this PR to release/2.9.5, if you have any questions, please ping me. thanks. |
Fixes #16705
Motivation
When the
getBundleWithHighestThroughputmethod try to use((ModularLoadManagerWrapper)loadManager).getLoadManager().getBundleDataOrDefault(bundle.toString());get the bundle load data, the load data might already updated by load manager.pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java
Lines 1109 to 1119 in 4483df2
Also, we should give the
bundleWithHighestThroughputa default value, since is possible to return a null value.Modifications
writeResourceQuotasToZooKeepertask by set load balancer enabled false.Documentation
Check the box below or label this PR directly.
Need to update docs?
doc-required(Your PR needs to update docs and you will update later)
doc-not-needed(Please explain why)
doc(Your PR contains doc changes)
doc-complete(Docs have been already added)