Copilot commented on code in PR #16142:
URL: https://github.com/apache/pinot/pull/16142#discussion_r2197179730


##########
pinot-core/src/main/java/org/apache/pinot/core/accounting/PerQueryCPUMemAccountantFactory.java:
##########
@@ -814,14 +837,21 @@ void killAllQueries() {
 
         if (config.isOomKillQueryEnabled()) {
           int killedCount = 0;
+          Set<String> terminatedQueryIds = new HashSet<>();
           for (Map.Entry<Thread, 
CPUMemThreadLevelAccountingObjects.ThreadEntry> entry : 
_threadEntriesMap.entrySet()) {
             CPUMemThreadLevelAccountingObjects.ThreadEntry threadEntry = 
entry.getValue();
             CPUMemThreadLevelAccountingObjects.TaskEntry taskEntry = 
threadEntry.getCurrentThreadTaskStatus();
-            if (taskEntry != null && taskEntry.isAnchorThread()) {
-              threadEntry._errorStatus
-                  .set(new RuntimeException(String.format("Query killed due to 
%s out of memory!", _instanceType)));
-              taskEntry.getAnchorThread().interrupt();
-              killedCount += 1;
+            if (taskEntry != null && 
!terminatedQueryIds.contains(taskEntry.getQueryId())) {
+              if (_queryCancelCallbacks.containsKey(taskEntry.getQueryId())) {

Review Comment:
   When cancelling via callback, `killedCount` is not incremented, so the 
query-killed metric may undercount. Consider incrementing `killedCount` in the 
callback branch as well.



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