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


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/DiskBalancerManager.java:
##########
@@ -287,45 +282,16 @@ private HddsProtos.DatanodeDiskBalancerInfoProto 
getInfoProto(
     return builder.build();
   }
 
-  /**
-   * Get volume density for a specific DatanodeDetails node.
-   *
-   * @param datanodeDetails DatanodeDetails
-   * @return DiskBalancer report.
-   */
-  private double getVolumeDataDensitySumForDatanodeDetails(
-      DatanodeDetails datanodeDetails) {
-    Preconditions.checkArgument(datanodeDetails instanceof DatanodeInfo);
-
-    DatanodeInfo datanodeInfo = (DatanodeInfo) datanodeDetails;
-
-    double totalCapacity = 0d, totalFree = 0d;
-    for (StorageReportProto reportProto : datanodeInfo.getStorageReports()) {
-      totalCapacity += reportProto.getCapacity();
-      totalFree += reportProto.getRemaining();
-    }
-
-    Preconditions.checkArgument(totalCapacity != 0);
-    double idealUsage = (totalCapacity - totalFree) / totalCapacity;
-
-    double volumeDensitySum = datanodeInfo.getStorageReports().stream()
-        .map(report ->
-            Math.abs(((double) (report.getCapacity() - report.getRemaining())) 
/ report.getCapacity()
-                - idealUsage))
-        .mapToDouble(Double::valueOf).sum();
-
-    return volumeDensitySum;
-  }
-
   public DiskBalancerStatus getStatus(DatanodeDetails datanodeDetails) {
     return statusMap.computeIfAbsent(datanodeDetails,
-        dn -> new DiskBalancerStatus(DiskBalancerRunningStatus.UNKNOWN, new 
DiskBalancerConfiguration(), 0, 0, 0, 0));
+        dn -> new DiskBalancerStatus(DiskBalancerRunningStatus.UNKNOWN, new 
DiskBalancerConfiguration(),
+            0, 0, 0, 0, 0.0));

Review Comment:
   "0" is used here for unknown status, while Double.NaN is used below for same 
unknown status. We should use the same value to represent unknown.  



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