[
https://issues.apache.org/jira/browse/HDFS-10915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15527878#comment-15527878
]
Mingliang Liu commented on HDFS-10915:
--------------------------------------
Thanks for the patch.
Can you also replace the code that uses {{System.currentTimeMillis()}} with
{{System.nanoTime()}}.
The reason is that the granularity of {{System.currentTimeMillis()}} depends on
the implementation and on the OS and is usually around 10 ms (up to 100ms on
some platforms). Instead, {{System.nanoTime()}} returns the current value of
the most precise available system timer (in nanoseconds). The latter is perfect
to calculate elapsed time. Specially, in Hadoop, we can use
{{org.apache.hadoop.util#monotonicNow()}} for getting the start/end time.
> fix typo in TestDatanodeRestart#testWaitForRegistrationOnRestart
> ----------------------------------------------------------------
>
> Key: HDFS-10915
> URL: https://issues.apache.org/jira/browse/HDFS-10915
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: test
> Reporter: Xiaobing Zhou
> Assignee: Xiaobing Zhou
> Priority: Minor
> Attachments: HDFS-10915.000.patch
>
>
> It should be milliseconds in the message of IOException.
> {code}
> } catch (org.apache.hadoop.ipc.RemoteException e) {
> long elapsed = System.currentTimeMillis() - start;
> // timers have at-least semantics, so it should be at least 5 seconds.
> if (elapsed < 5000 || elapsed > 10000) {
> throw new IOException(elapsed + " seconds passed.", e);
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]