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 Fri, 25 May 2012 03:50:23 GMT

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

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

bq. Low bits values should depend on high bits; try max = (1L << 32) + (1L <<
16)

(1L << 32) + (1L << 16) = 4295032832.
I guess I can sort of see what you're getting at here.  The (1L << 16) part will be
completely ignored with this current code.

bq. High bits should range from 0 to highMax INCLUSIVELY in some cases; try (1L << 32)
- 1

(1L << 32) - 1 = 0xffffffff
This is MAX_INT.  So you'll take the first branch of the 'if' statement and get a number between
[0 and 0xffffffff).
So, it works fine here.

bq. Two 31-bit int's cannot handle a 63-bit long; try Long.MAX_VALUE

Now this criticism is fair.  It could be fixed by just using nextInt() rather than nextInt(Int.MAX_INT)
to get the lower half of the return value.

I think I can fix this code to work in the 64-bit case.  The big insight of this code was
that a uniformly randomly distributed 63-bit number can be viewed as a linear decomposition
of several smaller uniformly distributed random numbers.

I'm tempted to try fixing this.  However, it may be more practical to limit ourselves to 31-bit
values...
                
> 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
>
>
> 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