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

Daryn Sharp commented on HDFS-1833:
-----------------------------------

I'm a bit confused by the semantics of this new method:

{code}
private boolean isDownstreamLengthZero() {
  return downstreams != null && downstreams.length == 0;
}
{code}

It seems like it means "isLastPacketResponder()".  However, it appears that a 
"downstreams == null" is not the same as a 0-length array?

Later there is new code for "downstreams != null && downstreams.length > 0".  
Why not use "!isDownstreamLengthZero()"?

Would it maybe make sense to ensure downstreams is initialized to an empty 
array even when null is passed in, and then use downstreams.length?


> Refactor BlockReceiver
> ----------------------
>
>                 Key: HDFS-1833
>                 URL: https://issues.apache.org/jira/browse/HDFS-1833
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: data-node
>            Reporter: Tsz Wo (Nicholas), SZE
>            Assignee: Tsz Wo (Nicholas), SZE
>            Priority: Minor
>             Fix For: 0.23.0
>
>         Attachments: h1833_20110412.patch
>
>
> There are repeated codes for creating log/error messages in BlockReceiver.  
> Also, some comment in the codes are incorrect, e.g.
> {code}
> private int numTargets;     // number of downstream datanodes including myself
> {code}
> but the count indeed excludes the current datanode.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to