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

Eli Collins commented on HDFS-3837:
-----------------------------------

I investigated some more and confirmed findbugs isn't searching back far enough 
for the common subclass. Eg if I swap variables in the equals call I get:

{noformat}
org.apache.hadoop.hdfs.protocol.DatanodeInfo.equals(Object) used to determine 
equality
org.apache.hadoop.hdfs.server.common.JspHelper$NodeRecord.equals(Object) used 
to determine equality
org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor.equals(Object) 
used to determine equality
At DataNode.java:[line 1871]
{noformat}

It stops at DatanodeDescriptor#equals even though this calls super.equals 
(DatanodeInfo) which calls super.equals (DatanodeID). Just like the current 
warning stops at DatanodeRegistration#equals which calls super.equals 
(DatanodeID).

It would be better (and findbugs wouldn't choke) if the various classes that 
extend DatanodeID have a member instead. I looked at this for HDFS-3237 and it 
required a ton of changes that probably aren't worth it.

Given this I'll update the patch per your suggestion Surresh to ignore the 
warning in DataNode#recoverBlock.
                
> Fix DataNode.recoverBlock findbugs warning
> ------------------------------------------
>
>                 Key: HDFS-3837
>                 URL: https://issues.apache.org/jira/browse/HDFS-3837
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: data-node
>    Affects Versions: 2.0.0-alpha
>            Reporter: Eli Collins
>            Assignee: Eli Collins
>         Attachments: hdfs-3837.txt, hdfs-3837.txt, hdfs-3837.txt, 
> hdfs-3837.txt
>
>
> HDFS-2686 introduced the following findbugs warning:
> {noformat}
> Call to equals() comparing different types in 
> org.apache.hadoop.hdfs.server.datanode.DataNode.recoverBlock(BlockRecoveryCommand$RecoveringBlock)
> {noformat}
> Both are using DatanodeID#equals but it's a different method because 
> DNR#equals overrides equals for some reason (doesn't change behavior).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to