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

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

In {{DatanodeInfo#getDatanodeReport}}, we translate {{DatanodeInfo#lastUpdate}} 
into a date:

{code}
    buffer.append("Last contact: "+new Date(lastUpdate)+"\n");
{code}

This is not going to work if {{lastUpdate}} is a monotonic time.  The easiest 
way to solve this is to maintain another {{long}} with the wall-clock time, 
which we set to the current wall-clock time whenever an update occurs.  That 
way we get the benefits of calculating staleness and deadness based on 
monotonic time, but also reasonable information in {{getDatanodeReport}}.

{{FSNamesystem#reached}}: The same issue occurs here.

{code}
      if (reached > 0)
        resText += " Threshold was reached " + new Date(reached) + ".";
{code}

{{EditLogTailer#lastLoadTimestamp}}: can we rename this to {{lastLoadTimeMs}}?  
It is not a timestamp (those come from the wall clock, generally.)  We could 
probably get rid of {{EditLogTailer#getLastLoadTimestamp}} since the only use 
is in {{FSNamesystem#getMillisSinceLastLoadedEdits}}.  All we need is a 
function which returns the amount of time since the edits were last loaded.

> Use Time.monotonicNow() wherever applicable instead of Time.now()
> -----------------------------------------------------------------
>
>                 Key: HDFS-6841
>                 URL: https://issues.apache.org/jira/browse/HDFS-6841
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: Vinayakumar B
>            Assignee: Vinayakumar B
>         Attachments: HDFS-6841-001.patch, HDFS-6841-002.patch
>
>
> {{Time.now()}} used  in many places to calculate elapsed time.
> This should be replaced with {{Time.monotonicNow()}} to avoid effect of 
> System time changes on elapsed time calculations.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to