vrajat commented on code in PR #16445:
URL: https://github.com/apache/pinot/pull/16445#discussion_r2251764188
##########
pinot-core/src/main/java/org/apache/pinot/core/accounting/PerQueryCPUMemAccountantFactory.java:
##########
@@ -880,19 +901,37 @@ void reschedule() {
void killAllQueries() {
QueryMonitorConfig config = _queryMonitorConfig.get();
- if (config.isOomKillQueryEnabled()) {
+ if (config.isOomKillQueryEnabled() && !config.isThreadSelfTerminate())
{
int killedCount = 0;
for (Map.Entry<Thread,
CPUMemThreadLevelAccountingObjects.ThreadEntry> entry :
_threadEntriesMap.entrySet()) {
CPUMemThreadLevelAccountingObjects.ThreadEntry threadEntry =
entry.getValue();
CPUMemThreadLevelAccountingObjects.TaskEntry taskEntry =
threadEntry.getCurrentThreadTaskStatus();
- if (taskEntry != null &&
!_cancelSentQueries.contains(taskEntry.getQueryId())) {
- cancelQuery(taskEntry.getQueryId(), taskEntry.getAnchorThread());
+ if (taskEntry != null &&
_cancelSentQueries.add(taskEntry.getQueryId())) {
+ String queryId = taskEntry.getQueryId();
+ // The cache will be invalidated after the termination is logged.
+ MseCancelCallback callback =
_queryCancelCallbacks.getIfPresent(queryId);
+ if (callback != null) {
+ callback.cancelQuery(Long.parseLong(queryId));
+ } else {
+ taskEntry.getAnchorThread().interrupt();
+ }
Review Comment:
I did try to consolidate. The differences are:
* other instances use `QueryResourceTracker` while this loop uses
`TaskEntry` (thread metadata vs query metadata)
* Logging is done outside the loop here. The code should not log for every
thread.
Both of these difference made it hard and I gave up.
--
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]