[ 
https://issues.apache.org/jira/browse/HDFS-16216?focusedWorklogId=659084&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-659084
 ]

ASF GitHub Bot logged work on HDFS-16216:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 01/Oct/21 17:16
            Start Date: 01/Oct/21 17:16
    Worklog Time Spent: 10m 
      Work Description: goiri commented on a change in pull request #3415:
URL: https://github.com/apache/hadoop/pull/3415#discussion_r720413175



##########
File path: 
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterMountTable.java
##########
@@ -356,22 +356,29 @@ public void testGetMountPointStatus() throws IOException {
     String child = "testA";
     Path childPath = new Path(src, child);
     HdfsFileStatus dirStatus =
-        clientProtocol.getMountPointStatus(childPath.toString(), 0, 0);
+        clientProtocol.getMountPointStatus(childPath.toString(), 0, 0, true);
     assertEquals(child, dirStatus.getLocalName());
 
     String src1 = "/testA";
     String child1 = "testB";
     Path childPath1 = new Path(src1, child1);
     HdfsFileStatus dirStatus1 =
-        clientProtocol.getMountPointStatus(childPath1.toString(), 0, 0);
+        clientProtocol.getMountPointStatus(childPath1.toString(), 0, 0, true);
     assertEquals(child1, dirStatus1.getLocalName());
 
     String src2 = "/testA/testB";
     String child2 = "testC";
     Path childPath2 = new Path(src2, child2);
     HdfsFileStatus dirStatus2 =
-        clientProtocol.getMountPointStatus(childPath2.toString(), 0, 0);
+        clientProtocol.getMountPointStatus(childPath2.toString(), 0, 0, true);
     assertEquals(child2, dirStatus2.getLocalName());
+
+    String src3 = "/testA/testB/testC";
+    String child3 = "testD";
+    Path childPath3 = new Path(src3, child3);
+    HdfsFileStatus dirStatus3 =
+        clientProtocol.getMountPointStatus(childPath3.toString(), 0, 0, false);
+    assertTrue(dirStatus3.getLocalName().length() == 0);

Review comment:
       assertEquals

##########
File path: 
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterClientProtocol.java
##########
@@ -919,10 +919,10 @@ public HdfsFileStatus getFileInfo(String src) throws 
IOException {
         if (dates != null && dates.containsKey(src)) {
           date = dates.get(src);
         }
-        ret = getMountPointStatus(src, children.size(), date);
+        ret = getMountPointStatus(src, children.size(), date, false);

Review comment:
       It looks like false is kind of the exception for this method.
   Can we keep the old signature with `true` as the default?

##########
File path: 
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterMountTable.java
##########
@@ -356,22 +356,29 @@ public void testGetMountPointStatus() throws IOException {
     String child = "testA";
     Path childPath = new Path(src, child);
     HdfsFileStatus dirStatus =
-        clientProtocol.getMountPointStatus(childPath.toString(), 0, 0);
+        clientProtocol.getMountPointStatus(childPath.toString(), 0, 0, true);
     assertEquals(child, dirStatus.getLocalName());
 
     String src1 = "/testA";
     String child1 = "testB";
     Path childPath1 = new Path(src1, child1);
     HdfsFileStatus dirStatus1 =
-        clientProtocol.getMountPointStatus(childPath1.toString(), 0, 0);
+        clientProtocol.getMountPointStatus(childPath1.toString(), 0, 0, true);
     assertEquals(child1, dirStatus1.getLocalName());
 
     String src2 = "/testA/testB";
     String child2 = "testC";
     Path childPath2 = new Path(src2, child2);
     HdfsFileStatus dirStatus2 =
-        clientProtocol.getMountPointStatus(childPath2.toString(), 0, 0);
+        clientProtocol.getMountPointStatus(childPath2.toString(), 0, 0, true);
     assertEquals(child2, dirStatus2.getLocalName());
+
+    String src3 = "/testA/testB/testC";
+    String child3 = "testD";
+    Path childPath3 = new Path(src3, child3);
+    HdfsFileStatus dirStatus3 =
+        clientProtocol.getMountPointStatus(childPath3.toString(), 0, 0, false);
+    assertTrue(dirStatus3.getLocalName().length() == 0);

Review comment:
       I think there's also isEmpty() for the string.
   Could we also check for some other attribute other than getLocalName()?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 659084)
    Time Spent: 1h 20m  (was: 1h 10m)

> RBF: Wrong path when get mount point status
> -------------------------------------------
>
>                 Key: HDFS-16216
>                 URL: https://issues.apache.org/jira/browse/HDFS-16216
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: zhuobin zheng
>            Assignee: zhuobin zheng
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> When we get mount point status, we will get wrong path in file status.
> {code:java}
> // prepare mount env
> hdfs dfsrouteradmin -add /test ns1 /test
> hdfs dfsrouteradmin -add /test/test1/test2/test3 ns1 /test/test1/test2/test3
> {code}
> {code:java}
> // java code
> public class TmpOp { 
> public static void main(String[] args) throws Exception { 
>   Configuration conf = new HdfsConfiguration(); 
>   FileSystem fs = FileSystem.get(conf); 
>   FileStatus test = fs.getFileStatus(new Path("/test")); 
>   FileStatus test1 = fs.getFileStatus(new Path("/test/test1")); 
>   FileStatus test2 = fs.getFileStatus(new Path("/test/test1/test2"));     
>   System.out.println(test.getPath()); 
>   System.out.println(test1.getPath()); 
>   System.out.println(test2.getPath()); 
> } 
> }
> {code}
>  
> {code:java}
> // result
> hdfs://ns1/test/test
> hdfs://ns1/test/test1/test1
> hdfs://ns1/test/test1/test2/test2
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to