Gargi-jais11 commented on code in PR #11322:
URL: https://github.com/apache/ozone/pull/11322#discussion_r4205414480


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/policy/DefaultContainerChoosingPolicy.java:
##########
@@ -91,62 +98,98 @@ public ContainerCandidate 
chooseVolumesAndContainer(OzoneContainer ozoneContaine
         return null;
       }
 
-      // Calculate ideal usage and threshold range (once)
-      final double idealUsage = getIdealUsage(volumeUsages);
-      final double actualThreshold = thresholdPercentage / 100.0;
-      final double lowerThreshold = idealUsage - actualThreshold;
-      final double upperThreshold = idealUsage + actualThreshold;
-
-      if (LOG.isDebugEnabled()) {
-        logVolumeBalancingState(volumeUsages, idealUsage, thresholdPercentage,
-            lowerThreshold, upperThreshold, deltaMap);
+      // Balance each storage type independently so a container never crosses 
types. Iterate
+      // StorageType.values() rather than the grouping keys to keep the order 
stable across runs.
+      final Map<StorageType, List<VolumeFixedUsage>> usagesByStorageType = 
volumeUsages.stream()
+          .collect(Collectors.groupingBy(v -> v.getVolume().getStorageType()));
+      for (StorageType storageType : StorageType.values()) {

Review Comment:
   >  I propose ranking eligible storage-type groups by their current threshold 
violation.
   
   This makes sense, agreed.



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

Reply via email to