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

ASF GitHub Bot commented on HDFS-16724:
---------------------------------------

ZanderXu commented on code in PR #4719:
URL: https://github.com/apache/hadoop/pull/4719#discussion_r944633782


##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterClientProtocol.java:
##########
@@ -935,19 +935,22 @@ public BatchedDirectoryListing getBatchedListing(String[] 
srcs,
   public HdfsFileStatus getFileInfo(String src) throws IOException {
     rpcServer.checkOperation(NameNode.OperationCategory.READ);
 
-    final List<RemoteLocation> locations =
-        rpcServer.getLocationsForPath(src, false, false);
-    RemoteMethod method = new RemoteMethod("getFileInfo",
-        new Class<?>[] {String.class}, new RemoteParam());
-
     HdfsFileStatus ret = null;
-    // If it's a directory, we check in all locations
-    if (rpcServer.isPathAll(src)) {
-      ret = getFileInfoAll(locations, method);
-    } else {
-      // Check for file information sequentially
-      ret = rpcClient.invokeSequential(
-          locations, method, HdfsFileStatus.class, null);
+    IOException noLocationException = null;
+    try {
+      final List<RemoteLocation> locations = 
rpcServer.getLocationsForPath(src, false, false);
+      RemoteMethod method = new RemoteMethod("getFileInfo",
+          new Class<?>[] {String.class}, new RemoteParam());
+
+      // If it's a directory, we check in all locations
+      if (rpcServer.isPathAll(src)) {
+        ret = getFileInfoAll(locations, method);
+      } else {
+        // Check for file information sequentially
+        ret = rpcClient.invokeSequential(locations, method, 
HdfsFileStatus.class, null);
+      }
+    } catch (NoLocationException | RouterResolveException e) {

Review Comment:
   Sorry, sir. `MountableResolver.class` may return one null response. So we 
still need this NoLocationException.
   ```
   private PathLocation buildLocation(
         final String path, final MountTable entry) throws IOException {
       String srcPath = entry.getSourcePath();
       if (!path.startsWith(srcPath)) {
         LOG.error("Cannot build location, {} not a child of {}", path, 
srcPath);
         return null;
       }
   }
   ```





> RBF should support get the information about ancestor mount points
> ------------------------------------------------------------------
>
>                 Key: HDFS-16724
>                 URL: https://issues.apache.org/jira/browse/HDFS-16724
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: ZanderXu
>            Assignee: ZanderXu
>            Priority: Major
>              Labels: pull-request-available
>
> Suppose RBF cluster have 2 nameservices and to mount point as below:
>  * /user/ns1 -> ns1 -> /user/ns1
>  * /usre/ns2 -> ns2 -> /user/ns2
> Suppose we disable default nameservice of the RBF cluster and try to 
> getFileInfo of the path /user, RBF will throw one IOException to client due 
> to can not find locations for path /user. 
> But as this case, RBF should should return one valid response to client, 
> because /user has two sub mount point ns1 and ns2.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to