ChenSammi commented on code in PR #8056:
URL: https://github.com/apache/ozone/pull/8056#discussion_r1990917281
##########
hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/datanode/DiskBalancerStatusSubcommand.java:
##########
@@ -85,9 +88,20 @@ private String generateStatus(
String.valueOf(proto.getDiskBalancerConf().getParallelThread()));
contentList.add(String.valueOf(proto.getSuccessMoveCount()));
contentList.add(String.valueOf(proto.getFailureMoveCount()));
+ contentList.add(estimatedTimeLeft >= 0 ? String.format("%.2f",
estimatedTimeLeft) : "N/A");
}
return String.format(formatBuilder.toString(),
contentList.toArray(new String[0]));
}
+
+ private double
calculateEstimatedTimeLeft(HddsProtos.DatanodeDiskBalancerInfoProto proto) {
+ long estimatedDataPendingToMove =
proto.getEstimatedTotalSizePendingToMove();
+ double bandwidth = proto.getDiskBalancerConf().getDiskBandwidthInMB();
+
+ // Convert estimated data from bytes to MB
+ double estimatedDataPendingMB = estimatedDataPendingToMove / (1024.0 *
1024.0);
+ double estimatedTimeLeft = (bandwidth > 0) ? (estimatedDataPendingMB /
bandwidth) / 60 : -1;
+ return estimatedTimeLeft;
Review Comment:
Let return long here, and round up to next number. For example, if it's 0.1,
then return 1.
--
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]