hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vinayakumar B (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-6355) Fix divide-by-zero, improper use of wall-clock time in BlockPoolSliceScanner
Date Sat, 10 May 2014 22:06:42 GMT

    [ 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

View raw message