hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Colin Patrick McCabe (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-3456) blockReportInterval is long value but when we take the random value it uses getRandom().nextInt,it is causing frequently BR
Date Wed, 30 May 2012 22:07:23 GMT

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

Colin Patrick McCabe commented on HDFS-3456:
--------------------------------------------

I have a feeling that people will keep running into these kind of bugs where they typecast
between long and int, and screw it up.  That was the motivation for creating nextRandomLong.

Regarding version 3 of the patch:  It's true that nextRandomDouble() only gives 53 bits of
randomness, but the JavaDoc for my helper function clearly states that the resolution is limited
by floating point rounding errors.  I'm assuming that was the "bug" you referred to, since
you didn't specify.  Of course, it's clear that people might not realize this limitation when
they call the function, so this is a legitimate cause for concern.

I don't have time to make this quite as perfect as I would like.  So I will stick to fixing
the immediate problem, and not make nextRandomLong.  If we see any more bugs like this, then
I guess we can link them back to here and evaluate whether this decision was the right one.
                
> blockReportInterval is long value but when we take the random value it uses getRandom().nextInt,it
is causing frequently BR
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-3456
>                 URL: https://issues.apache.org/jira/browse/HDFS-3456
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: data-node
>    Affects Versions: 2.0.0-alpha
>            Reporter: Brahma Reddy Battula
>            Assignee: Colin Patrick McCabe
>            Priority: Minor
>         Attachments: HDFS-3456.001.patch, HDFS-3456.002.patch, HDFS-3456.003.patch
>
>
> blockReportInterval is long value but when we take the random value it uses getRandom().nextInt.
> Due to this, offerService can throw exception as long may get rotated to negative value.
> So, block report may send very frequently.
> {code}
>       if (resetBlockReportTime) {
>         lastBlockReport = startTime - DFSUtil.getRandom().nextInt((int)(dnConf.blockReportInterval));
>       resetBlockReportTime = false;
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message