adoroszlai commented on code in PR #8590:
URL: https://github.com/apache/ozone/pull/8590#discussion_r2140400268


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/HddsVolume.java:
##########
@@ -194,6 +195,12 @@ public VolumeInfoMetrics getVolumeInfoStats() {
     return volumeInfoMetrics;
   }
 
+  public boolean isVolumeFull() {
+    SpaceUsageSource currentUsage = getCurrentUsage();
+    // if the volume is failed, this method will implicitly return true 
because available space will be 0
+    return currentUsage.getAvailable() - 
getFreeSpaceToSpare(currentUsage.getCapacity()) <= 0;
+  }

Review Comment:
   Please move calculation to `VolumeUsage`, near:
   
   
https://github.com/apache/ozone/blob/6bf009c2029765c73df503d2515c267238db9996/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/VolumeUsage.java#L182-L185
   
   
https://github.com/apache/ozone/blob/6bf009c2029765c73df503d2515c267238db9996/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/VolumeUsage.java#L191-L193
   
   We should avoid scattering such logic in more places.



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