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.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]