You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "Vinayakumar B (JIRA)" <ji...@apache.org> on 2014/05/11 00:06:42 UTC

[jira] [Commented] (HDFS-6355) Fix divide-by-zero, improper use of wall-clock time in BlockPoolSliceScanner

    [ https://issues.apache.org/jira/browse/HDFS-6355?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13992645#comment-13992645 ] 

Vinayakumar B commented on HDFS-6355:
-------------------------------------

Changes looks good. 
One small doubt.
{code}+    long timeLeft = Math.max(1L,
+        currentPeriodStart + scanPeriod - Time.monotonicNow());{code}
Here since we already use monotonicNow(), which is relative to jvm startup, I don't think we will get a negative value here and hence no need to take a max(..). 

Anyway, there is no harm if its there, if you feel its fine, then I am ok with it :), +1

> Fix divide-by-zero, improper use of wall-clock time in BlockPoolSliceScanner
> ----------------------------------------------------------------------------
>
>                 Key: HDFS-6355
>                 URL: https://issues.apache.org/jira/browse/HDFS-6355
>             Project: Hadoop HDFS
>          Issue Type: Bug
>    Affects Versions: 2.4.0
>            Reporter: Colin Patrick McCabe
>            Assignee: Colin Patrick McCabe
>         Attachments: HDFS-6355.001.patch
>
>
> BlockPoolSliceScanner uses {{Time.now}} to calculate an interval.  But this is incorrect, since if the wall-clock time changes, we will end up setting the scan periods to a shorter or longer time than we configured.
> There is also a case where we may divide by zero if we get unlucky, because we calculate an interval and divide by it, without checking whether the interval is 0 milliseconds.  This would produce an {{ArithmeticException}} since we are using longs.



--
This message was sent by Atlassian JIRA
(v6.2#6252)