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

Uma Maheswara Rao G commented on HDFS-6995:
-------------------------------------------

Thanks a lot Vinay for update on patch!

Here I have some few nits:
- .
{code}
   for (int i = 0; i < 5; i++) {
+      String src = "/test-" + i;
+      // Create the file with client machine
+      HdfsFileStatus fileStatus = namesystem.startFile(src, perm,
+          clientMachine, clientMachine, EnumSet.of(CreateFlag.CREATE), true,
+          REPLICATION_FACTOR, DEFAULT_BLOCK_SIZE, null);
+      LocatedBlock locatedBlock = nameNodeRpc.addBlock(src, clientMachine,
+          null, null, fileStatus.getFileId(), null);
+
+      assertEquals("First datanode should be rack local", "/RACK2",
+          locatedBlock.getLocations()[0].getNetworkLocation());
+
+      nameNodeRpc.abandonBlock(locatedBlock.getBlock(), fileStatus.getFileId(),
+          src, clientMachine);
+    }
{code}
Seems like this peice of code is duplicate except assertion. Could we refactor 
a bit to avoid this?

- Test name should say thsi test for Default placement policy?

- .
{code}
perm = new PermissionStatus("TestNamenodeRetryCache", null,
+        FsPermission.getDefault());
{code}
Seems like copies this line from other tests. changing string name to current 
test will looks good. But not a big deal.



> Block should be placed in the client's 'rack-local' node if 'client-local' 
> node is not available
> ------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-6995
>                 URL: https://issues.apache.org/jira/browse/HDFS-6995
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: namenode
>    Affects Versions: 2.5.0
>            Reporter: Vinayakumar B
>            Assignee: Vinayakumar B
>         Attachments: HDFS-6995-001.patch, HDFS-6995-002.patch, 
> HDFS-6995-003.patch, HDFS-6995-004.patch, HDFS-6995-005.patch
>
>
> HDFS cluster is rack aware.
> Client is in different node than of datanode,
> but Same rack contains one or more datanodes.
> In this case first preference should be given to select 'rack-local' node.
> Currently, since no Node in clusterMap corresponds to client's location, 
> blockplacement policy choosing a *random* node as local node and proceeding 
> for further placements.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to