You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/08/04 16:12:32 UTC

[GitHub] [ozone] mukul1987 commented on a change in pull request #2303: HDDS-5283. getStorageSize cast to int can cause issue

mukul1987 commented on a change in pull request #2303:
URL: https://github.com/apache/ozone/pull/2303#discussion_r682762322



##########
File path: hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/HddsUtils.java
##########
@@ -612,4 +615,11 @@ public static String format(List<String> nodes) {
   public static long getShutDownTimeOut(ConfigurationSource conf) {
     return conf.getObject(OzoneServiceConfig.class).getServiceShutdownTimeout();
   }
+
+  /**
+   * Utility method to round up bytes into the nearest MB.
+   */
+  public static int roundupMb(long bytes) {
+    return Math.toIntExact((bytes - 1) / ONE_MB + 1);

Review comment:
       This will always compute to a long, and this will not be a floating point number. Also I think there should be a utility to perform this.




-- 
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-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org