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

Konstantin Shvachko commented on HADOOP-321:
--------------------------------------------

In fact DatanodeDescriptor needs everything that it inherits from DatanodeInfo
even the Writable.read() and Writable.write().
The last two are going to be used for logging and check pointing of 
DatanodeDescriptor-s.
What is not used in DatanodeDescriptor is the Writable factory, because 
descriptors are not
meant to be used in RPC communications. That is why the factory is defined for 
DatanodeInfo
but not for the descriptor class.
So if we go the composition way we will particularly need to implement Writable 
for
DatanodeDescriptor, the only purpose of which would be to call the DatanodeInfo 
Writable methods.
Why? With inheritance it is already there. And the same applies to all other 
methods.

A few words about the bug that caused this discussion.
I did not realize that RPC sends classes based on the actual object instances 
rather than on the type declarations.
So DatanodeDescriptor was sent even though the variable was declared as 
DatanodeInfo.
The receiving side then was not able to instantiate the received 
DatanodeDescriptor class because the factory is
not defined for it. DatanodeInfo was expected to be received.


> 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
>
> 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