[
https://issues.apache.org/jira/browse/HDFS-16672?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17585252#comment-17585252
]
ASF GitHub Bot commented on HDFS-16672:
---------------------------------------
cxzl25 commented on PR #4598:
URL: https://github.com/apache/hadoop/pull/4598#issuecomment-1228251220
> Sorry for the late response. But I did not get why System.nanoTime() may
return a negative number. Do you mind to offer any jdk information? Thanks.
>
> > System.nanoTime()may return a negative number, the comparison here may
be wrong.
https://docs.oracle.com/javase/8/docs/api/index.html
public static long nanoTime()
> (perhaps in the future, so values may be negative)
>
> one should use t1 - t0 < 0, not t1 < t0, because of the possibility of
numerical overflow.
> Fix lease interval comparison in BlockReportLeaseManager
> --------------------------------------------------------
>
> Key: HDFS-16672
> URL: https://issues.apache.org/jira/browse/HDFS-16672
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: namenode
> Reporter: dzcxzl
> Assignee: dzcxzl
> Priority: Trivial
> Labels: pull-request-available
> Time Spent: 50m
> Remaining Estimate: 0h
>
> monotonicNowMs is generated by System.nanoTime(), direct comparison is not
> recommended.
>
> org.apache.hadoop.hdfs.server.blockmanagement.BlockReportLeaseManager#pruneIfExpired
> {code:java}
> if (monotonicNowMs < node.leaseTimeMs + leaseExpiryMs) {
> return false;
> } {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]