ChenSammi commented on code in PR #8167:
URL: https://github.com/apache/ozone/pull/8167#discussion_r2017841765


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/AvailableSpaceFilter.java:
##########
@@ -39,14 +39,11 @@ public class AvailableSpaceFilter implements 
Predicate<HddsVolume> {
 
   @Override
   public boolean test(HddsVolume vol) {
-    SpaceUsageSource usage = vol.getCurrentUsage();
-    long volumeCapacity = usage.getCapacity();
-    long free = usage.getAvailable();
+    StorageLocationReport report = vol.getReport();
+    long free = report.getRemaining();
     long committed = vol.getCommittedBytes();
     long available = free - committed;
-    long volumeFreeSpaceToSpare = vol.getFreeSpaceToSpare(volumeCapacity);
-    boolean hasEnoughSpace = VolumeUsage.hasVolumeEnoughSpace(free, committed,
-        requiredSpace, volumeFreeSpaceToSpare);
+    boolean hasEnoughSpace = VolumeUsage.hasVolumeEnoughSpace(report, 
requiredSpace);
 
     mostAvailableSpace = Math.max(available, mostAvailableSpace);

Review Comment:
   Why not change the fullVolumes to Map<HddsVolume, Long> and save available 
directly? 
   
   



-- 
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: issues-unsubscr...@ozone.apache.org

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


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

Reply via email to