[ 
http://issues.apache.org/jira/browse/HADOOP-321?page=comments#action_12418380 ] 

Owen O'Malley commented on HADOOP-321:
--------------------------------------

DatanodeDescriptor may in the future be Writable, but the current version in 
your patch is not. It doesn't implement readFields or write and just inherits 
the ones from DatanodeInfo, which will ignore the TreeMap in the 
DatanodeDescriptor.

In my experience, using inheritance for implementation is extremely brittle. It 
leads to confusing code that is easy to break. This has been born out both by 
this bad patch and Milind's very reasonable attempt to fix it that was 
incorrect because of this design idiom. Another instance when it caused trouble 
was having the FSNameSystem.FileUnderConstruction inherit from Vector. It was 
fine, until I tried to make changes to it and the code broke in strange ways. 
Obviously it can work, I just think create problematic code.

I think that composition is a much better idiom for doing this kind of stuff.

> DatanodeInfo refactoring
> ------------------------
>
>          Key: HADOOP-321
>          URL: http://issues.apache.org/jira/browse/HADOOP-321
>      Project: Hadoop
>         Type: Improvement

>   Components: dfs
>     Reporter: Konstantin Shvachko
>     Assignee: Konstantin Shvachko
>      Fix For: 0.5.0
>  Attachments: DatanodeInfo_refactor.patch, DatanodeInfo_refactor3.patch, 
> DatanodeInfo_refactor4.patch
>
> I'm trying to refactor some name node classes, which seem to be similar.
> So DatanodeInfo is a public api now for purely external ( to name node) use.
> The name node class that stores information about data nodes including the
> set of its blocks is called DatanodeDescriptor.
> The DatanodeReport is removed since it was a variation of DatanodeInfo.
> Previously DatanodeInfo and DatanodeDescriptor were the same class, and
> DatanodeReport was used for reporting node statistics only.
> This is a preparation step for HADOOP-306.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to