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

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

hfutatzhanghb commented on code in PR #7422:
URL: https://github.com/apache/hadoop/pull/7422#discussion_r1991740176


##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/async/TestRouterAsyncRPCMultipleDestinationMountTableResolver.java:
##########
@@ -84,6 +97,43 @@ public static void setUp() throws Exception {
     rpcServer =routerContext.getRouter().getRpcServer();
   }
 
+  @Test
+  public void testLocalResolverGetDatanodesSubcluster() throws IOException {
+    String testPath = "/testLocalResolverGetDatanodesSubcluster";
+    Path path = new Path(testPath);
+    Map<String, String> destMap = new HashMap<>();
+    destMap.put("ns0", testPath);
+    destMap.put("ns1", testPath);
+    nnFs0.mkdirs(path);
+    nnFs1.mkdirs(path);
+    MountTable addEntry =
+        MountTable.newInstance(testPath, destMap);
+    addEntry.setQuota(new RouterQuotaUsage.Builder().build());
+    addEntry.setDestOrder(DestinationOrder.LOCAL);
+    assertTrue(addMountTable(addEntry));
+
+    Map<String, String> datanodesSubcluster = null;
+    try {
+      MultipleDestinationMountTableResolver resolver =
+          (MultipleDestinationMountTableResolver) 
routerContext.getRouter().getSubclusterResolver();
+      LocalResolver localResolver =
+          (LocalResolver) resolver.getOrderedResolver(DestinationOrder.LOCAL);
+      datanodesSubcluster = localResolver.getDatanodesSubcluster();
+    } catch (Exception e) {
+      LOG.info("Exception occurs when 
testLocalResolverGetDatanodesSubcluster.", e);
+    } finally {
+      RouterClient client = routerContext.getAdminClient();
+      MountTableManager mountTableManager = client.getMountTableManager();
+      RemoveMountTableEntryRequest req2 =
+          RemoveMountTableEntryRequest.newInstance(testPath);
+      mountTableManager.removeMountTableEntry(req2);
+      nnFs0.delete(new Path(testPath), true);
+      nnFs1.delete(new Path(testPath), true);
+    }
+    assertNotNull(datanodesSubcluster);
+    assertTrue(!datanodesSubcluster.isEmpty());

Review Comment:
   @KeeProMise Thanks a lot for your reviewing, have fixed. Wait yetus~ 





> [ARR] LocalResolver#getDatanodesSubcluster adapts to async rpc
> --------------------------------------------------------------
>
>                 Key: HDFS-17735
>                 URL: https://issues.apache.org/jira/browse/HDFS-17735
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: rbf
>            Reporter: farmmamba
>            Assignee: farmmamba
>            Priority: Major
>              Labels: pull-request-available
>
> LocalResolver#getDatanodesSubcluster adapts to async rpc



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