heesung-sn commented on code in PR #20552:
URL: https://github.com/apache/pulsar/pull/20552#discussion_r1224521358
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/ExtensibleLoadManagerImpl.java:
##########
@@ -714,6 +734,12 @@ private void monitor() {
}
}
+ public NamespaceBundle getNamespaceBundle(String bundle) {
Review Comment:
Nit:move this to a static LoadManagerShared method.
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/ExtensibleLoadManagerImpl.java:
##########
@@ -180,6 +183,23 @@ public class ExtensibleLoadManagerImpl implements
ExtensibleLoadManager {
.build();
private final CountDownLatch initWaiter = new CountDownLatch(1);
+ /**
+ * Get all the bundles that are owned by this broker.
+ */
+ public Set<NamespaceBundle> getOwnedServiceUnits() {
+ var entrySet = serviceUnitStateChannel.getOwnershipEntrySet();
+ return entrySet.stream()
+ .filter(entry -> {
+ var stateData = entry.getValue();
+ return stateData.state() == ServiceUnitState.Owned
+ && StringUtils.isNotBlank(stateData.dstBroker())
+ &&
stateData.dstBroker().equals(brokerRegistry.getBrokerId());
Review Comment:
Nit: should we define a local var brokerId to avoid repeated registry access?
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/namespace/NamespaceService.java:
##########
@@ -1103,6 +1134,10 @@ public OwnershipCache getOwnershipCache() {
}
public Set<NamespaceBundle> getOwnedServiceUnits() {
+ if (ExtensibleLoadManagerImpl.isLoadManagerExtensionEnabled(config)) {
Review Comment:
It appears that the new vs old LM logic variations in NamespaceService are
more than what we originally estimated. Yes, we can define
NamespaceServiceExtension extends NamespaceService.
If the community decides to only maintain the extension logic in the
future(I assume this wont happen in the near future), I think we can clean the
old LMlogic in NamespaceService too.
--
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]