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?  I would suggest remove AvailableSpace right in this patch if there 
is already a refactor plan, since AvailableSpace is only used internally by 
AvailableSpaceFilter. 
   
   



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