[
https://issues.apache.org/jira/browse/HDFS-3456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13286200#comment-13286200
]
Andy Isaacson commented on HDFS-3456:
-------------------------------------
{quote}2**53 milliseconds is thousands of years. I'm willing to guess that if
the block report delay is set that high, we have other problems besides a
slightly granular random number generator.{quote}
Precisely, *this* code does not care about the exact random value used. That's
why it's fine to use nextDouble or whatever, *here*. But we should not add a
helper function that appears to provide a generic interface, but fails to
implement that interface fully.
.004.patch LGTM. I'm also fine with the suggestion to throw an exception if
the delay is greater than Integer.MAX_VALUE. We don't need to preserve
bug-for-bug compatibility with clearly unreasonable configurations -- a config
that sets the reportInterval to many days can get different behavior and we
don't care. (So long as the different behavior is not too surprising.)
One tiny nit -- please fix the spacing in
{code}
- - ( dnConf.blockReportInterval -
DFSUtil.getRandom().nextInt((int)(delay)));
{code}
there should not be a space between "(" and "dnConf". You had fixed this in
.003 but it fell out of .004. :)
Thanks for driving this issue,
-andy
> 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, HDFS-3456.004.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