[ https://issues.apache.org/jira/browse/HDFS-9847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15202559#comment-15202559 ]
Arpit Agarwal commented on HDFS-9847: ------------------------------------- Thank you for updating the patch [~linyiqun]. Few comments for parseTimeDuration. # parseTimeDuration should not default to zero. This condition can be hit only if defaultValue is null. Let's just throw HadoopIllegalArgumentException. {code} if (timeStr == null) { LOG.warn("No time value str for " + name + ", using default duration value 0 instead."); return 0; } {code} # Up-converting a unit should be an error e.g. if heartbeat interval is specified as 500ms or 2500ms but we expect it to be seconds. I haven't tested it but I think the following check at the end of parseTimeDuration will guard against loss of precision. {code} long raw = Long.parseLong(timeStr); long converted = unit.convert(raw, vUnit.unit()); if (vUnit.unit().convert(converted, unit) != raw) { throw new HadoopIllegalArgumentException("Loss of precision converting " + timeStr + " to " + vUnit); } return converted; {code} # We should add a unit test for (2). The rest of the patch lgtm. > HDFS configuration without time unit name should accept friendly time units > --------------------------------------------------------------------------- > > Key: HDFS-9847 > URL: https://issues.apache.org/jira/browse/HDFS-9847 > Project: Hadoop HDFS > Issue Type: Sub-task > Affects Versions: 2.7.1 > Reporter: Lin Yiqun > Assignee: Lin Yiqun > Attachments: HDFS-9847.001.patch, HDFS-9847.002.patch, > HDFS-9847.003.patch, HDFS-9847.004.patch, HDFS-9847.005.patch, > timeduration-w-y.patch > > > In HDFS-9821, it talks about the issue of leting existing keys use friendly > units e.g. 60s, 5m, 1d, 6w etc. But there are som configuration key names > contain time unit name, like {{dfs.blockreport.intervalMsec}}, so we can make > some other configurations which without time unit name to accept friendly > time units. The time unit {{seconds}} is frequently used in hdfs. We can > updating this configurations first. -- This message was sent by Atlassian JIRA (v6.3.4#6332)