vrajat commented on code in PR #16445:
URL: https://github.com/apache/pinot/pull/16445#discussion_r2242610128
##########
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:
_cancelSentQueries is created using `ConcurrentHashMap.newKeySet()`. So it
is backed by a ConcurrentHashMap. Is add still not atomic ?
State your sources.
--
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]