heesung-sn commented on code in PR #20058: URL: https://github.com/apache/pulsar/pull/20058#discussion_r1162218388
########## pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/filter/BrokerLMClassFilter.java: ########## @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.pulsar.broker.loadbalance.extensions.filter; + +import java.util.Map; +import org.apache.pulsar.broker.loadbalance.BrokerFilterException; +import org.apache.pulsar.broker.loadbalance.extensions.LoadManagerContext; +import org.apache.pulsar.broker.loadbalance.extensions.data.BrokerLookupData; +import org.apache.pulsar.common.naming.ServiceUnitId; + +public class BrokerLMClassFilter implements BrokerFilter { + + public static final String FILTER_NAME = "broker_LM_class_filter"; + @Override + public String name() { + return FILTER_NAME; + } + + @Override + public Map<String, BrokerLookupData> filter( + Map<String, BrokerLookupData> brokers, + ServiceUnitId serviceUnit, + LoadManagerContext context) + throws BrokerFilterException { + if (brokers.isEmpty()) { + return brokers; + } + brokers.entrySet().removeIf(entry -> { + BrokerLookupData v = entry.getValue(); + return !v.getLoadManagerClassName().equals(context.brokerConfiguration().getLoadManagerClassName()); Review Comment: Sorry, we are redirecting the lookups to those brokers who have the latest LM name. I think we are good here. ########## pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/BrokerLMClassFilter.java: ########## @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.pulsar.broker.loadbalance.impl; + +import java.util.Set; +import org.apache.pulsar.broker.ServiceConfiguration; +import org.apache.pulsar.broker.loadbalance.BrokerFilter; +import org.apache.pulsar.broker.loadbalance.BrokerFilterException; +import org.apache.pulsar.broker.loadbalance.LoadData; +import org.apache.pulsar.policies.data.loadbalancer.BundleData; + +public class BrokerLMClassFilter implements BrokerFilter { + + @Override + public void filter(Set<String> brokers, BundleData bundleToAssign, + LoadData loadData, + ServiceConfiguration conf) throws BrokerFilterException { + loadData.getBrokerData().forEach((key, value) -> { + if (!value.getLocalData().getLoadManagerClassName() + .equals(conf.getLoadManagerClassName())) { Review Comment: Similarly, during the ExtensionLM deployment, the brokers before deployment could still have the ModularLM class name in its config. In this case, the brokers will still assign bundles to the brokers with ModularLM class name. Are admins expected to update the loadbalance class name for all brokers first, and then start deployment? -- 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: commits-unsubscr...@pulsar.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org