[
https://issues.apache.org/jira/browse/HDFS-3456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13283804#comment-13283804
]
Colin Patrick McCabe commented on HDFS-3456:
--------------------------------------------
Hi Nicholas,
I appreciate you taking the time to look at this (minor) JIRA and the bugs you
found in my code.
I feel like there are a lot of issues similar to this lurking in the code where
we cast between long and int. It is simply not a good practice to perform
unchecked typecasts. The lack of a nextLong() method tends to produce this
kind of code. For that reason alone, it would be a good addition to Hadoop--
don't you agree?
Check out HDFS-2541, where we also needed a nextRandomLong, didn't have it, and
ended up doing an (incorrect) typecast. The problem is more widespread than
you think. Does that make sense at all? The alternative is to change a lot of
our long configuration values to int, or introduce artificial maximum values
for them.
> 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