xyuanlu commented on code in PR #2969:
URL: https://github.com/apache/helix/pull/2969#discussion_r1920822915


##########
helix-core/src/main/java/org/apache/helix/controller/stages/CurrentStateComputationStage.java:
##########
@@ -356,6 +356,11 @@ void handleResourceCapacityCalculation(ClusterEvent event, 
ResourceControllerDat
       CurrentStateOutput currentStateOutput) {
     Map<String, Resource> resourceMap = 
event.getAttribute(AttributeName.RESOURCES.name());
     if (skipCapacityCalculation(cache, resourceMap, event)) {
+      // Ensure instance capacity is null if there are no resources. This 
prevents using a stale map when all resources
+      // are removed and then a new resource is added.
+      if (resourceMap == null || resourceMap.isEmpty()) {

Review Comment:
   if (skipCapacityCalculation(cache, resourceMap, event) && (resourceMap == 
null || resourceMap.isEmpty()) ) {
       cache.clearWagedCapacityProviders();
   } 



##########
helix-core/src/main/java/org/apache/helix/controller/stages/CurrentStateComputationStage.java:
##########
@@ -356,6 +356,11 @@ void handleResourceCapacityCalculation(ClusterEvent event, 
ResourceControllerDat
       CurrentStateOutput currentStateOutput) {
     Map<String, Resource> resourceMap = 
event.getAttribute(AttributeName.RESOURCES.name());
     if (skipCapacityCalculation(cache, resourceMap, event)) {
+      // Ensure instance capacity is null if there are no resources. This 
prevents using a stale map when all resources
+      // are removed and then a new resource is added.
+      if (resourceMap == null || resourceMap.isEmpty()) {

Review Comment:
   `if (skipCapacityCalculation(cache, resourceMap, event) && (resourceMap == 
null || resourceMap.isEmpty()) ) {
       cache.clearWagedCapacityProviders();
   } `



-- 
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: reviews-unsubscr...@helix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@helix.apache.org
For additional commands, e-mail: reviews-h...@helix.apache.org

Reply via email to