poorbarcode commented on code in PR #21078:
URL: https://github.com/apache/pulsar/pull/21078#discussion_r1309875454
##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApi2Test.java:
##########
@@ -1740,6 +1750,20 @@ public void testDeleteNamespace(NamespaceAttr
namespaceAttr) throws Exception {
admin.topics().createPartitionedTopic(topic, 10);
assertFalse(admin.topics().getList(namespace).isEmpty());
+ // export bundle-data to metadata store
+ final String managedLedgersPath = "/managed-ledgers/" + namespace;
+ final String bundleDataPath = "/loadbalance/bundle-data/" + namespace;
+ ModularLoadManagerImpl loadManager = (ModularLoadManagerImpl) getField(
+ pulsar.getLoadManager().get(), "loadManager");
+ MetadataCache<BundleData> bundlesCache = (MetadataCache<BundleData>)
getField(
+ loadManager, "bundlesCache");
+ final BundleData bundleData = new BundleData(10, 1000);
+ bundlesCache.readModifyUpdateOrCreate(bundleDataPath, __ ->
bundleData).join();
Review Comment:
```suggestion
// Trigger bundle owned by brokers.
pulsarClient.newProducer().topic(topic).create().close();
// Trigger bundle data write to ZK.
Awaitility.await().untilAsserted(() -> {
boolean bundleDataWereWriten = false;
for (PulsarService ps : new PulsarService[]{pulsar,
mockPulsarSetup.getPulsar()}) {
ModularLoadManagerWrapper loadManager =
(ModularLoadManagerWrapper) ps.getLoadManager().get();
ModularLoadManagerImpl loadManagerImpl =
(ModularLoadManagerImpl) loadManager.getLoadManager();
ps.getBrokerService().updateRates();
loadManagerImpl.updateLocalBrokerData();
loadManagerImpl.writeBundleDataOnZooKeeper();
bundleDataWereWriten = bundleDataWereWriten ||
ps.getLocalMetadataStore().exists(bundleDataPath).join();
}
assertTrue(bundleDataWereWriten);
});
```
--
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]