vrajat commented on code in PR #16445:
URL: https://github.com/apache/pinot/pull/16445#discussion_r2251767829


##########
pinot-core/src/main/java/org/apache/pinot/core/accounting/PerQueryCPUMemAccountantFactory.java:
##########
@@ -539,15 +560,18 @@ protected void logQueryResourceUsage(Map<String, ? 
extends QueryResourceTracker>
       LOGGER.warn("Query aggregation results {} for the previous kill.", 
aggregatedUsagePerActiveQuery);
     }
 
-    public void cancelQuery(String queryId, Thread anchorThread) {
-      MseCancelCallback callback = _queryCancelCallbacks.getIfPresent(queryId);
-      if (callback != null) {
-        callback.cancelQuery(Long.parseLong(queryId));
-        _queryCancelCallbacks.invalidate(queryId);
-      } else {
-        anchorThread.interrupt();
+    public void cancelQuery(QueryResourceTracker queryResourceTracker, Thread 
anchorThread) {
+      String queryId = queryResourceTracker.getQueryId();
+      if (_cancelSentQueries.add(queryId)) {
+        MseCancelCallback callback = 
_queryCancelCallbacks.getIfPresent(queryId);
+        if (callback != null) {
+          callback.cancelQuery(Long.parseLong(queryId));
+          _queryCancelCallbacks.invalidate(queryId);
+        } else {
+          anchorThread.interrupt();
+        }

Review Comment:
   I hadnt realized hard-cancel (this PR) is so easy to implement. I want to 
delete callbacks, anchor threads and reduce watcher task to only aggregate 
data. Do not try to interrupt threads. Let them self-terminate as in this code.



-- 
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]

Reply via email to