kerneltime commented on code in PR #3532:
URL: https://github.com/apache/ozone/pull/3532#discussion_r906912650


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/VolumeInfo.java:
##########
@@ -134,25 +135,45 @@ public VolumeInfo build() throws IOException {
   }
 
   private long getReserved(ConfigurationSource conf) {
+    final float defaultValue = Float.MAX_VALUE;
+    float percentage = conf.getFloat(HDDS_DATANODE_VOLUME_RESERVED,
+        defaultValue);
     Collection<String> reserveList = conf.getTrimmedStringCollection(
         HDDS_DATANODE_DIR_DU_RESERVED);
-    for (String reserve : reserveList) {
-      String[] words = reserve.split(":");
-      if (words.length < 2) {
-        LOG.error("Reserved space should config in pair, but current is {}",
-            reserve);
-        continue;
-      }
+    //Both the configs are set. Log it and return 0
+    if (reserveList.size() > 0 && percentage != defaultValue) {

Review Comment:
   Should the behavior be to pick the max of the 2 values? Would be less 
problematic than not honoring any reserved space.



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/VolumeInfo.java:
##########
@@ -134,25 +135,45 @@ public VolumeInfo build() throws IOException {
   }
 
   private long getReserved(ConfigurationSource conf) {
+    final float defaultValue = Float.MAX_VALUE;
+    float percentage = conf.getFloat(HDDS_DATANODE_VOLUME_RESERVED,
+        defaultValue);
     Collection<String> reserveList = conf.getTrimmedStringCollection(
         HDDS_DATANODE_DIR_DU_RESERVED);
-    for (String reserve : reserveList) {
-      String[] words = reserve.split(":");
-      if (words.length < 2) {
-        LOG.error("Reserved space should config in pair, but current is {}",
-            reserve);
-        continue;
-      }
+    //Both the configs are set. Log it and return 0
+    if (reserveList.size() > 0 && percentage != defaultValue) {

Review Comment:
   Should the behavior be to pick the max of the 2 values? Would be less 
problematic than not honoring any reserved space?



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