turboFei commented on a change in pull request #27943: [SPARK-31179] Fast fail
the connection while last connection failed in fast fail time window
URL: https://github.com/apache/spark/pull/27943#discussion_r402100291
##########
File path:
common/network-common/src/main/java/org/apache/spark/network/client/TransportClientFactory.java
##########
@@ -192,11 +206,30 @@ public TransportClient createClient(String remoteHost,
int remotePort)
logger.info("Found inactive connection to {}, creating a new one.",
resolvedAddress);
}
}
- clientPool.clients[clientIndex] = createClient(resolvedAddress);
+ // If this connection should fast fail when last connection failed in
last fast fail time
+ // window and it did, fail this connection directly.
+ if (fastFail && System.currentTimeMillis() -
clientPool.lastConnectionFailed <
+ fastFailTimeWindow) {
+ throw new IOException(
+ String.format("Connecting to %s failed in the last %s ms, fail this
connection directly",
+ resolvedAddress, fastFailTimeWindow));
+ }
+ try {
+ clientPool.clients[clientIndex] = createClient(resolvedAddress);
+ clientPool.lastConnectionFailed = 0;
+ } catch (IOException e) {
+ clientPool.lastConnectionFailed = System.currentTimeMillis();
+ throw e;
+ }
return clientPool.clients[clientIndex];
}
}
+ public TransportClient createClient(String remoteHost, int remotePort)
Review comment:
I think it is not necessary, because it is a public method.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]