klsince commented on code in PR #9171:
URL: https://github.com/apache/pinot/pull/9171#discussion_r946175155


##########
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java:
##########
@@ -167,6 +182,60 @@ private String getDefaultBrokerId() {
     }
   }
 
+  @Override
+  public Map<Long, String> getRunningQueries() {
+    return 
_queriesById.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e 
-> e.getValue()._query));
+  }
+
+  @VisibleForTesting
+  Set<ServerInstance> getRunningServers(long queryId) {
+    if (_queriesById.isEmpty()) {
+      return Collections.emptySet();
+    }
+    return _queriesById.get(queryId)._servers;
+  }
+
+  @Override
+  public boolean cancelQuery(long queryId, int timeoutMs, Executor executor, 
HttpConnectionManager connMgr,
+      Map<String, Integer> serverResponses) {
+    QueryRoutingTable routingTable = _queriesById.get(queryId);
+    if (routingTable == null) {
+      return false;
+    }
+    String globalId = getGlobalQueryId(queryId);
+    List<String> serverUrls = new ArrayList<>();
+    for (ServerInstance server : routingTable._servers) {
+      serverUrls.add(String.format("%s/query/%s", server.getAdminEndpoint(), 
globalId));
+    }
+    if (serverUrls.isEmpty()) {
+      LOGGER.debug("No servers running the query: {} right now", globalId);
+      return true;
+    }
+    LOGGER.debug("Cancelling the query: {} via server urls: {}", globalId, 
serverUrls);
+    CompletionService<DeleteMethod> completionService =

Review Comment:
   added a TODO about the race condition we discussed.



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to