dang-stripe commented on code in PR #17466:
URL: https://github.com/apache/pinot/pull/17466#discussion_r2670004994
##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/service/dispatch/QueryDispatcher.java:
##########
@@ -555,6 +555,25 @@ private DispatchClient
getOrCreateDispatchClient(QueryServerInstance queryServer
return _dispatchClientMap.computeIfAbsent(hostnamePort, k -> new
DispatchClient(hostname, port, _tlsConfig));
}
+ /**
+ * Resets the DispatchClient for a server, clearing stale gRPC channel state
and creating a fresh connection.
+ * Call this when a server is re-enabled to bypass gRPC's exponential
backoff on reconnection which will cause
+ * requests to fast fail.
+ */
+ public void resetDispatchClient(ServerInstance serverInstance) {
+ String hostname = serverInstance.getHostname();
+ int port = serverInstance.getQueryServicePort();
+ String hostnamePort = String.format("%s_%d", hostname, port);
+ _dispatchClientMap.compute(hostnamePort, (key, oldClient) -> {
+ LOGGER.info("Resetting DispatchClient for server: {}",
serverInstance.getInstanceId());
+ if (oldClient != null) {
+ LOGGER.info("Shutting down old channel for server: {}",
serverInstance.getInstanceId());
+ oldClient.getChannel().shutdown();
Review Comment:
`resetConnectBackoff` did also fix it so I've updated the PR to use that
instead and included testing results.
##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/service/dispatch/QueryDispatcher.java:
##########
@@ -555,6 +555,25 @@ private DispatchClient
getOrCreateDispatchClient(QueryServerInstance queryServer
return _dispatchClientMap.computeIfAbsent(hostnamePort, k -> new
DispatchClient(hostname, port, _tlsConfig));
}
+ /**
+ * Resets the DispatchClient for a server, clearing stale gRPC channel state
and creating a fresh connection.
+ * Call this when a server is re-enabled to bypass gRPC's exponential
backoff on reconnection which will cause
+ * requests to fast fail.
+ */
+ public void resetDispatchClient(ServerInstance serverInstance) {
+ String hostname = serverInstance.getHostname();
+ int port = serverInstance.getQueryServicePort();
+ String hostnamePort = String.format("%s_%d", hostname, port);
+ _dispatchClientMap.compute(hostnamePort, (key, oldClient) -> {
+ LOGGER.info("Resetting DispatchClient for server: {}",
serverInstance.getInstanceId());
+ if (oldClient != null) {
+ LOGGER.info("Shutting down old channel for server: {}",
serverInstance.getInstanceId());
+ oldClient.getChannel().shutdown();
Review Comment:
`resetConnectBackoff` did also fix it so I've updated the PR to use that
instead and included testing results in the description.
--
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]