adoroszlai commented on a change in pull request #1970:
URL: https://github.com/apache/ozone/pull/1970#discussion_r590046864
##########
File path:
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/VolumeInfo.java
##########
@@ -83,6 +88,24 @@ public VolumeInfo build() throws IOException {
}
}
+ private long getReserved(ConfigurationSource conf) {
+ Collection<String> reserveList = conf.getTrimmedStringCollection(
+ HDDS_DATANODE_DIR_DU_RESERVED);
+ for (String reserve : reserveList) {
+ String[] words = reserve.split(":");
+ if (words.length < 2) {
+ throw new IllegalArgumentException(
+ "Reserved space should config in pair");
Review comment:
Throwing `IllegalArgumentException` instead of the
`ArrayIndexOutOfBoundsException` still shuts down datanode during startup.
I think if the config is invalid, it should be ignored with a warning log
message.
##########
File path:
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/VolumeInfo.java
##########
@@ -83,6 +88,24 @@ public VolumeInfo build() throws IOException {
}
}
+ private long getReserved(ConfigurationSource conf) {
+ Collection<String> reserveList = conf.getTrimmedStringCollection(
+ HDDS_DATANODE_DIR_DU_RESERVED);
+ for (String reserve : reserveList) {
+ String[] words = reserve.split(":");
+ if (words.length < 2) {
+ throw new IllegalArgumentException(
+ "Reserved space should config in pair");
+ }
+
+ if (words[0].trim().equals(rootDir)) {
+ return Long.parseLong(words[1].trim());
Review comment:
This throws exception if the specified value is not a number. Also,
what about negative values?
Now reserved space needs to be bytes. Can we add support for storage units
(eg. KB, MB, etc.)? `StorageSize.parse` may be helpful here.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]