slfan1989 commented on code in PR #10355:
URL: https://github.com/apache/ozone/pull/10355#discussion_r3296944253


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/diskbalancer/DiskBalancerService.java:
##########
@@ -743,13 +743,15 @@ public static List<VolumeReportProto> 
buildVolumeReportProto(List<VolumeFixedUsa
     List<VolumeReportProto> result = new ArrayList<>();
     for (VolumeFixedUsage v : volumeSet) {
       HddsVolume volume = v.getVolume();
+      double utilization = v.getUsage().getCapacity() == 0
+          ? 0.0 : v.getUtilization();

Review Comment:
   That makes sense. Since utilization is exposed as a double value, using 
nullable Double makes callers handle an implicit special case and can lead to 
NPEs.
   
   I will change VolumeFixedUsage.utilization to primitive double and use 1.0 
for zero-capacity volumes. This keeps zero-capacity volumes from being treated 
as valid low-utilization targets, while avoiding NaN-specific handling in 
sorting, reporting, and threshold comparisons.



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