siddhantsangwan commented on a change in pull request #2441:
URL: https://github.com/apache/ozone/pull/2441#discussion_r680925885
##########
File path:
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancer.java
##########
@@ -180,6 +198,16 @@ private boolean initializeIteration() {
return false;
}
+ this.clusterCapacity = 0L;
+ this.clusterUsed = 0L;
+ this.clusterRemaining = 0L;
+
+ this.selectedContainers = new HashSet<>();
+ this.overUtilizedNodes = new ArrayList<>();
+ this.underUtilizedNodes = new ArrayList<>();
+ this.withinThresholdUtilizedNodes = new ArrayList<>();
+ this.unBalancedNodes = new ArrayList<>();
Review comment:
Since one purpose of `intitalizeIteration` is to initialize the fields
necessary for balancing, it seems clearer to initialize these values here
instead of `calculateAvgUtilization`. Also since those lists need to be
initialized at least once, we need to create them here. Instead, if this
initialization is moved to the constructor, we will need to construct every
time we want to restart balancer.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]