Demogorgon314 commented on code in PR #19154:
URL: https://github.com/apache/pulsar/pull/19154#discussion_r1064426727


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/strategy/LeastResourceUsageWithWeight.java:
##########
@@ -43,21 +41,17 @@ public class LeastResourceUsageWithWeight implements 
BrokerSelectionStrategy {
     // Maintain this list to reduce object creation.
     private final ArrayList<String> bestBrokers;
     private final Set<String> noLoadDataBrokers;
-    private final Map<String, Double> brokerAvgResourceUsageWithWeight;
 
     public LeastResourceUsageWithWeight() {
         this.bestBrokers = new ArrayList<>();
-        this.brokerAvgResourceUsageWithWeight = new HashMap<>();
         this.noLoadDataBrokers = new HashSet<>();
     }
 
     // A broker's max resource usage with weight using its historical load and 
short-term load data with weight.
     private double getMaxResourceUsageWithWeight(final String broker, final 
BrokerLoadData brokerLoadData,
                                                  final ServiceConfiguration 
conf, boolean debugMode) {
         final double overloadThreshold = 
conf.getLoadBalancerBrokerOverloadedThresholdPercentage() / 100.0;
-        final double maxUsageWithWeight =
-                updateAndGetMaxResourceUsageWithWeight(broker, brokerLoadData, 
conf, debugMode);
-
+        final var maxUsageWithWeight = brokerLoadData.getWeightedMaxEMA();

Review Comment:
   The `weightedMaxEMA` can be null. Should we handle the null case here?



-- 
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]

Reply via email to