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


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeConfiguration.java:
##########
@@ -719,6 +750,39 @@ public void validate() {
       rocksdbDeleteObsoleteFilesPeriod =
           ROCKSDB_DELETE_OBSOLETE_FILES_PERIOD_MICRO_SECONDS_DEFAULT;
     }
+
+    validateMinFreeSpace();
+  }
+
+  /**
+   * If 'hdds.datanode.volume.min.free.space' is defined,
+   * it will be honored first. If it is not defined and
+   * 'hdds.datanode.volume.min.free.space.percent' is defined, it will honor 
this
+   * else it will fall back to 'hdds.datanode.volume.min.free.space.default'
+   */
+  private void validateMinFreeSpace() {
+    if (minFreeSpaceRatio > 1) {
+      LOG.warn("{} = {} is invalid, should be between 0 and 1",
+          HDDS_DATANODE_VOLUME_MIN_FREE_SPACE_PERCENT, minFreeSpaceRatio);
+      minFreeSpaceRatio = MIN_FREE_SPACE_UNSET;
+    }
+
+    final boolean minFreeSpaceConfigured = minFreeSpace >= 0;
+    final boolean minFreeSpaceRatioConfigured = minFreeSpaceRatio >= 0;
+
+    if (minFreeSpaceConfigured && minFreeSpaceRatioConfigured) {

Review Comment:
   This previous logic doesn't make all sense,  based on the L758 comments, I 
think we should  honors min.free.space first if it's defined, then honor 
min.free.space.percent if min.free.space is not defined, then fallback to 
default 5GB if none of them are defined. 



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