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

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

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


##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/async/RouterAsyncRpcClient.java:
##########
@@ -627,4 +697,46 @@ public <T> T invokeSingle(
     invokeSequential(locations, remoteMethod);
     return asyncReturn(clazz);
   }
+
+  protected void acquirePermit(final String nsId, final UserGroupInformation 
ugi,
+      final Method m, RouterRpcFairnessPolicyController controller)
+      throws IOException {
+    if (controller != null) {
+      if (!controller.acquirePermit(nsId)) {
+        // Throw StandByException,
+        // Clients could fail over and try another router.
+        if (rpcMonitor != null) {
+          rpcMonitor.proxyOpPermitRejected(nsId);
+        }
+        incrRejectedPermitForNs(nsId);
+        LOG.debug("Permit denied for ugi: {} for method: {}",
+            ugi, m.getName());
+        String msg =
+            "Router " + router.getRouterId() +
+                " is overloaded for NS: " + nsId;
+        throw new StandbyException(msg);
+      }
+      if (rpcMonitor != null) {
+        rpcMonitor.proxyOpPermitAccepted(nsId);
+      }
+      incrAcceptedPermitForNs(nsId);
+    }
+  }

Review Comment:
   Nice suggestion, Have fixed.





> [ARR] Throtting asynchronous calls for each nameservice
> -------------------------------------------------------
>
>                 Key: HDFS-17713
>                 URL: https://issues.apache.org/jira/browse/HDFS-17713
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: rbf
>            Reporter: farmmamba
>            Assignee: farmmamba
>            Priority: Major
>              Labels: pull-request-available
>




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