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


##########
pinot-core/src/main/java/org/apache/pinot/core/accounting/PerQueryCPUMemAccountantFactory.java:
##########
@@ -319,8 +321,27 @@ public boolean isAnchorThreadInterrupted() {
     @Override
     public boolean isQueryTerminated() {
       QueryMonitorConfig config = _watcherTask.getQueryMonitorConfig();
-      if (config.isThreadSelfTerminate() && _watcherTask.getHeapUsageBytes() > 
config.getPanicLevel()) {
-        logSelfTerminatedQuery(_threadLocalEntry.get().getQueryId(), 
Thread.currentThread());
+      // if self-termination is not enabled, no need to check resource usage
+      if (!config.isThreadSelfTerminate()) {
+        return false;
+      }
+
+      long heapUsageBytes = _watcherTask.getHeapUsageBytes();
+      String queryId = _threadLocalEntry.get().getQueryId();
+      AggregatedStats maxResourceUsageQuery = _maxHeapUsageQuery.get();
+
+      if (heapUsageBytes > config.getPanicLevel()) {
+        if (_cancelSentQueries.add(queryId)) {

Review Comment:
   Probably copilot is not smart enough to know the runtime implementation used 
for the set. It may help if you change the static type from Set to 
ConcurrentHashMap.KeySetView



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