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

Chris Nauroth commented on HDFS-9319:
-------------------------------------

Hi [~jingzhao].  The patch looks good overall.  There is a small inconsistency 
in that {{volumeFailures}} and {{volumeFailureSummary}} are updated outside the 
lock, whereas all of the other heartbeat information is captured in 
{{DatanodeState}} and updated atomically inside the lock.  This is probably not 
a big deal in practice, but do you think it makes sense to expand the lock just 
a little to cover those 2 pieces of data?  This would guarantee that all state 
reflects the outcome of the last processed heartbeat.  For example:

{code}
    synchronized(this) {
      this.volumeFailures = volFailures;
      this.volumeFailureSummary = volumeFailureSummary;
      // Update total metrics for the node.
      updateState(totalCapacity, totalDfsUsed, totalRemaining, 
totalBlockPoolUsed,
          cacheCapacity, cacheUsed, lastUpdate, lastUpdateMonotonic, 
xceiverCount);
    }
{code}

Let me know your thoughts.  Thanks!

> Make DatanodeInfo thread safe
> -----------------------------
>
>                 Key: HDFS-9319
>                 URL: https://issues.apache.org/jira/browse/HDFS-9319
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>            Reporter: Jing Zhao
>            Assignee: Jing Zhao
>         Attachments: HDFS-9319.000.patch
>
>
> This jira plans to make DatanodeInfo's internal states independent of 
> external locks. Note because DatanodeInfo extends DatanodeID, we still need 
> to change DatanodeID as a follow-on work.



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

Reply via email to