wangbo commented on code in PR #27969: URL: https://github.com/apache/doris/pull/27969#discussion_r1415085807
########## fe/fe-core/src/main/java/org/apache/doris/resource/workloadgroup/QueryQueue.java: ########## @@ -132,14 +128,29 @@ public QueueOfferToken offer() throws InterruptedException { } } - public void poll() throws InterruptedException { - queueLock.tryLock(5, TimeUnit.SECONDS); + // If the token is acquired and do work success, then call this method to release it. + public void returnToken(QueueToken token) throws InterruptedException { + queueLock.lock(); try { + // If current token is not in the queue, then do nothing, just return. + if (!token.enqueueSuccess()) { + return; + } + // If current token is not in ready to run state, then it is still in the queue + // it is not running, just remove it. + if (!token.isReadyToRun()) { + this.priorityTokenQueue.remove(token); + return; + } currentRunningQueryNum--; Preconditions.checkArgument(currentRunningQueryNum >= 0); // maybe only when currentWaitingQueryNum != 0 need to signal if (currentRunningQueryNum < maxConcurrency) { - queueLockCond.signal(); + QueueToken nextToken = this.priorityTokenQueue.poll(); + if (nextToken != null) { + ++currentRunningQueryNum; + nextToken.signal(); Review Comment: Add log for signal and wait Exception -- 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...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org