adoroszlai commented on code in PR #8745:
URL: https://github.com/apache/ozone/pull/8745#discussion_r2185709490


##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/TestDatanodeConfiguration.java:
##########
@@ -274,4 +274,12 @@ static void assertWaitTimeMin(TimeDuration expected,
     assertEquals(expected, t,
         RaftServerConfigKeys.Log.Appender.WAIT_TIME_MIN_KEY);
   }
+
+  @Test
+  public void defaultMinFreeSpacePercentIsValid() {
+    OzoneConfiguration conf = new OzoneConfiguration();
+    
conf.unset(DatanodeConfiguration.HDDS_DATANODE_VOLUME_MIN_FREE_SPACE_PERCENT); 
// ensure default
+    DatanodeConfiguration subject = 
conf.getObject(DatanodeConfiguration.class);
+    assertEquals(0.001f, subject.getMinFreeSpaceRatio(), 1e-6);
+  }

Review Comment:
   This is already covered by:
   
   
https://github.com/apache/ozone/blob/4de2f10781377d506daf869aa659c7a583e30f10/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/TestDatanodeConfiguration.java#L181
   
   so we don't need to add a new test method.  Both old and new assertions pass 
without the change of `defaultValue` in `DatanodeConfiguration`.  That's 
because before this change the value is set by `validateMinFreeSpace()`, which 
emits the warning.  To test for the lack of warning, please capture log output 
and use its content for the assertion in the existing test case 
`isCreatedWitDefaultValues`.



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeConfiguration.java:
##########
@@ -294,7 +294,7 @@ public class DatanodeConfiguration extends 
ReconfigurableConfig {
   private long minFreeSpace = getDefaultFreeSpace();
 
   @Config(key = "hdds.datanode.volume.min.free.space.percent",
-      defaultValue = "-1",
+      defaultValue = "0.001", // changed from "-1" to a valid value, which is 
listed in Datanodes.md

Review Comment:
   I think a better comment would be:
   
   ```java
   // match HDDS_DATANODE_VOLUME_MIN_FREE_SPACE_PERCENT_DEFAULT
   ```



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