[
https://issues.apache.org/jira/browse/HDFS-9255?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14968172#comment-14968172
]
Zhe Zhang commented on HDFS-9255:
---------------------------------
Thanks for the clarification Walter. IIUC
{{DatanodeManager#getDatanode(DatanodeID nodeID)}} returns null for
{{EMPTY_DATANODE_ID}}, and that should be trimmed in {{trimmedTargets}} and
{{trimmedStorages}} right? In your updated logic, nothing will be done to null
entries in {{trimmedStorages}} anyway. Do we still need the change?
Some nits if we decide to do the above change:
# The current logic is not trimming {{null}} entries from {{newtargets}} so
{{trimmedStorages}} needs a better name
# Why do we deep copy {{storedBlock}} but not {{truncatedBlock}}?
{code}
if(copyTruncate) {
- storageInfo.addBlock(truncatedBlock, truncatedBlock);
+ trimmedStorages[i].addBlock(truncatedBlock, truncatedBlock);
} else {
- storageInfo.addBlock(storedBlock, storedBlock);
+ Block bi = new Block(storedBlock);
+ trimmedStorages[i].addBlock(storedBlock, bi);
}
{code}
# We can take the chance to change {{newtargets}} to {{newTargets}}, and change
the {{for (int i = 0; i < trimmedStorages.length}} loop to foreach style.
> Consolidate block recovery related implementation into a single class
> ---------------------------------------------------------------------
>
> Key: HDFS-9255
> URL: https://issues.apache.org/jira/browse/HDFS-9255
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: datanode
> Reporter: Walter Su
> Assignee: Walter Su
> Priority: Minor
> Attachments: HDFS-9255.01.patch, HDFS-9255.02.patch,
> HDFS-9255.03.patch, HDFS-9255.04.patch
>
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)