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

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

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


##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcServer.java:
##########
@@ -1765,6 +1765,9 @@ protected List<RemoteLocation> getLocationsForPath(String 
path,
           locs.add(loc);
         }
       }
+      if (locs.isEmpty()) {
+        throw new NoLocationException(path, 
this.subclusterResolver.getClass().getSimpleName());

Review Comment:
   fixed



##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterRpc.java:
##########
@@ -1547,6 +1547,24 @@ public void testRenewLeaseWithMultiStream() throws 
Exception {
     }
   }
 
+  @Test
+  public void testMkdirWithDisableNameService() throws Exception {
+    MockResolver resolver = 
(MockResolver)router.getRouter().getSubclusterResolver();
+    String ns0 = cluster.getNameservices().get(0);
+    resolver.addLocation("/mnt", ns0, "/");
+    MockResolver activeNamenodeResolver = 
(MockResolver)router.getRouter().getNamenodeResolver();
+    activeNamenodeResolver.disableNamespace(ns0);
+
+    try {
+      FsPermission permission = new FsPermission("777");
+      LambdaTestUtils.intercept(NoLocationException.class,
+          () -> router.getRouter().getRpcServer()

Review Comment:
   fixed





> RBF throw IndexOutOfBoundsException with disableNameServices
> ------------------------------------------------------------
>
>                 Key: HDFS-16728
>                 URL: https://issues.apache.org/jira/browse/HDFS-16728
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: ZanderXu
>            Assignee: ZanderXu
>            Priority: Major
>              Labels: pull-request-available
>
> RBF will throw an IndexOutOfBoundsException when the namespace is disabled.
> Suppose we have a mount point /a/b -> ns0 -> /a/b and we disabled the ns0.  
> RBF will throw IndexOutOfBoundsException during handling requests with path 
> starting with /a/b.
> {code:java}
> java.lang.IndexOutOfBoundsException: Index: 0, Size: 0    at 
> java.util.ArrayList.rangeCheck(ArrayList.java:657)
>     at java.util.ArrayList.get(ArrayList.java:433)
>     at 
> org.apache.hadoop.hdfs.server.federation.router.RouterClientProtocol.mkdirs(RouterClientProtocol.java:756)
>     at 
> org.apache.hadoop.hdfs.server.federation.router.RouterRpcServer.mkdirs(RouterRpcServer.java:980)
>  {code}



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

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to