kfaraz commented on a change in pull request #11566:
URL: https://github.com/apache/druid/pull/11566#discussion_r686915513
##########
File path:
services/src/main/java/org/apache/druid/server/AsyncQueryForwardingServlet.java
##########
@@ -292,6 +276,99 @@ protected void service(HttpServletRequest request,
HttpServletResponse response)
doService(request, response);
}
+ /**
+ * Issues async query cancellation requests to all Brokers (except the given
+ * targetServer). Query cancellation on the targetServer is handled by the
+ * proxy servlet.
+ */
+ private void broadcastQueryCancelRequest(HttpServletRequest request, Server
targetServer)
+ {
+ // send query cancellation to all brokers this query may have gone to
+ // to keep the code simple, the proxy servlet will also send a request to
the default targetServer.
+ for (final Server server : hostFinder.getAllServers()) {
+ if (server.getHost().equals(targetServer.getHost())) {
+ continue;
+ }
+
+ // issue async requests
+ Response.CompleteListener completeListener = result -> {
+ if (result.isFailed()) {
+ log.warn(
+ result.getFailure(),
+ "Failed to forward cancellation request to [%s]",
+ server.getHost()
+ );
+ }
+ };
+
+ Request broadcastReq = broadcastClient
+ .newRequest(rewriteURI(request, server.getScheme(),
server.getHost()))
+ .method(HttpMethod.DELETE)
+ .timeout(CANCELLATION_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
+
+ copyRequestHeaders(request, broadcastReq);
+ broadcastReq.send(completeListener);
+ }
+
+ interruptedQueryCount.incrementAndGet();
+ }
+
+ private Server getTargetServerForSql(
+ HttpServletRequest request,
+ ObjectMapper objectMapper
+ ) throws IOException
+ {
+ SqlQuery inputSqlQuery = objectMapper.readValue(request.getInputStream(),
SqlQuery.class);
+ request.setAttribute(SQL_QUERY_ATTRIBUTE, inputSqlQuery);
+
+ return inputSqlQuery != null
Review comment:
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]