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

Junping Du commented on HDFS-4990:
----------------------------------

Thanks for excellent work, Nicholas! The patch looks good to me, but have some 
minor comments.
{code}
-  private boolean isGoodTarget(DatanodeDescriptor node,$
+  private boolean isGoodTarget(DatanodeStorageInfo storage,$
                                long blockSize, int maxTargetPerRack,$
                                boolean considerLoad,$
-                               List<DatanodeDescriptor> results,               
            $
-                               boolean avoidStaleNodes) {$
+                               List<DatanodeStorageInfo> results,              
             $
+                               boolean avoidStaleNodes,$
+                               StorageType storageType) {$
+    if (storage.getStorageType() != storageType) {$
+      logNodeIsNotChosen(storage,$
+          "storage types do not match, where storageType=" + storageType);$
+      return false;$
+    }$
+    DatanodeDescriptor node = storage.getDatanodeDescriptor();$
     // check if the node is (being) decommissed$
     if (node.isDecommissionInProgress() || node.isDecommissioned()) {$
-      logNodeIsNotChosen(node, "the node is (being) decommissioned ");$
+      logNodeIsNotChosen(storage, "the node is (being) decommissioned ");$
       return false;$
     }$
 $
     if (avoidStaleNodes) {$
       if (node.isStale(this.staleInterval)) {$
-        logNodeIsNotChosen(node, "the node is stale ");$
+        logNodeIsNotChosen(storage, "the node is stale ");$
         return false;$
       }$
     }$
     $
{code}
the log info "storage types do not match, where storageType=" + storageType" is 
a little confusing, may be "where storageType should be " + storageType could 
be better? Also, do we think to check storage.getState() == NORMAL or != 
READ_ONLY?
There is some code style issues within this code block (not caused by your 
patch), i.e. unnecessary spaces after "results," and a typo of decommissed, see 
if you want to fix there.

                
> Block placement for storage types
> ---------------------------------
>
>                 Key: HDFS-4990
>                 URL: https://issues.apache.org/jira/browse/HDFS-4990
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: namenode
>            Reporter: Suresh Srinivas
>            Assignee: Tsz Wo (Nicholas), SZE
>         Attachments: h4990_20130909.patch, h4990_20130916.patch, 
> h4990_20130917b.patch, h4990_20130917c.patch, h4990_20130917.patch, 
> h4990_20130918.patch
>
>
> Currently block location for writes are made based on:
> # Datanode load (number of transceivers)
> # Space left on datanode
> # Topology
> With storage abstraction, namenode must choose a storage instead of a 
> datanode for block placement. It also needs to consider storage type, load on 
> the storage etc.
> As an additional benefit, currently HDFS support heterogeneous nodes (nodes 
> with different number of spindles etc.) poorly. This work should help solve 
> that issue as well.

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