[ https://issues.apache.org/jira/browse/HDFS-14346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16792088#comment-16792088 ]
Hudson commented on HDFS-14346: ------------------------------- SUCCESS: Integrated in Jenkins build Hadoop-trunk-Commit #16203 (See [https://builds.apache.org/job/Hadoop-trunk-Commit/16203/]) HDFS-14346. Add better time precision to Configuration#getTimeDuration, (xkrogen: rev 66357574ae1da09ced735da36bf7d80a40c3fa1b) * (edit) hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java * (edit) hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/mover/Mover.java * (edit) hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyDefault.java * (edit) hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/impl/DfsClientConf.java * (edit) hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java * (edit) hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Balancer.java * (edit) hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DNConf.java * (edit) hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfiguration.java * (edit) hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/EditLogTailer.java > Better time precision in getTimeDuration > ---------------------------------------- > > Key: HDFS-14346 > URL: https://issues.apache.org/jira/browse/HDFS-14346 > Project: Hadoop HDFS > Issue Type: Improvement > Components: namenode > Reporter: Chao Sun > Assignee: Chao Sun > Priority: Minor > Fix For: 3.0.4, 3.3.0, 3.2.1, 3.1.3 > > Attachments: HDFS-14346.000.patch, HDFS-14346.001.patch, > HDFS-14346.002.patch > > > Currently, {{Configuration#getTimeDuration}} has the following signature: > {code} > /** > * Return time duration in the given time unit. Valid units are encoded in > * properties as suffixes: nanoseconds (ns), microseconds (us), milliseconds > * (ms), seconds (s), minutes (m), hours (h), and days (d). > * @param name Property name > * @param defaultValue Value returned if no mapping exists. > * @param unit Unit to convert the stored property, if it exists. > * @throws NumberFormatException If the property stripped of its unit is not > * a number > */ > public long getTimeDuration(String name, long defaultValue, TimeUnit unit) > {code} > This may lose precision in case the default time unit is larger than the time > unit that the configuration value is converted to in the call sites of this > method. For instance, in {{EditLogTailer}} this method is used in the > following manner: > {code} > logRollPeriodMs = conf.getTimeDuration( > DFSConfigKeys.DFS_HA_LOGROLL_PERIOD_KEY, > DFSConfigKeys.DFS_HA_LOGROLL_PERIOD_DEFAULT, TimeUnit.SECONDS) * 1000; > sleepTimeMs = conf.getTimeDuration( > DFSConfigKeys.DFS_HA_TAILEDITS_PERIOD_KEY, > DFSConfigKeys.DFS_HA_TAILEDITS_PERIOD_DEFAULT, TimeUnit.SECONDS) * > 1000; > {code} > in both cases, the default time unit is second, and the configuration value > is converted into milli-seconds. Precision is lost when people want to > specify sub-second time duration such as {{100ms}}, which will be converted > to {{0ms}}. -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org