goiri commented on code in PR #4531:
URL: https://github.com/apache/hadoop/pull/4531#discussion_r923893873
##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestConnectionManager.java:
##########
@@ -304,7 +343,7 @@ private void testConnectionCleanup(float ratio, int
totalConns,
addConnectionsToPool(pool, totalConns - 1, activeConns - 1);
// There are activeConn connections.
- // We can cleanup the pool
+ // We can clean up the pool
Review Comment:
"cleanup" is correct
##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/ConnectionPool.java:
##########
@@ -437,23 +451,31 @@ protected static <T> ConnectionContext
newConnection(Configuration conf,
}
InetSocketAddress socket = NetUtils.createSocketAddr(nnAddress);
final long version = RPC.getProtocolVersion(classes.protoPb);
- Object proxy = RPC.getProtocolProxy(classes.protoPb, version, socket, ugi,
- conf, factory, RPC.getRpcTimeout(conf), defaultPolicy,
null).getProxy();
+ Object proxy;
+ if (enableMultiSocket) {
+ FederationConnectionId connectionId = new FederationConnectionId(
+ socket, classes.protoPb, ugi, RPC.getRpcTimeout(conf),
+ defaultPolicy, conf, socketIndex);
+ proxy = RPC.getProtocolProxy(classes.protoPb, version, connectionId,
+ conf, factory).getProxy();
+ } else {
+ proxy = RPC.getProtocolProxy(classes.protoPb, version, socket, ugi,
+ conf, factory, RPC.getRpcTimeout(conf), defaultPolicy,
null).getProxy();
+ }
+
T client = newProtoClient(proto, classes, proxy);
Text dtService = SecurityUtil.buildTokenService(socket);
- ProxyAndInfo<T> clientProxy =
- new ProxyAndInfo<T>(client, dtService, socket);
- ConnectionContext connection = new ConnectionContext(clientProxy);
- return connection;
+ ProxyAndInfo<T> clientProxy = new ProxyAndInfo<T>(client, dtService,
socket);
+ return new ConnectionContext(clientProxy, maxConcurrencyPerConn);
Review Comment:
Could we make it more generic and pass the `conf` instead of ad-hoc
arguments?
--
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]