yiguolei commented on code in PR #37559:
URL: https://github.com/apache/doris/pull/37559#discussion_r1675407840


##########
fe/fe-core/src/main/java/org/apache/doris/resource/workloadgroup/QueryQueue.java:
##########
@@ -126,30 +138,47 @@ public QueueToken getToken() throws UserException {
         }
     }
 
-    public void releaseAndNotify(QueueToken releaseToken) {
+    public void releaseAndNotify(QueueToken releaseToken, AdmissionControl ac) 
{
         queueLock.lock();
         try {
-            // NOTE:token's tokenState need to be locked by queueLock
-            if (releaseToken.isReadyToRun()) {
-                currentRunningQueryNum--;
-            } else {
-                priorityTokenQueue.remove(releaseToken);
-            }
-            Preconditions.checkArgument(currentRunningQueryNum >= 0);
-            while (currentRunningQueryNum < maxConcurrency) {
-                QueueToken queueToken = this.priorityTokenQueue.poll();
+            runningQueryQueue.remove(releaseToken);
+            waitingQueryQueue.remove(releaseToken);
+            releaseToken.release();
+            while (runningQueryQueue.size() < maxConcurrency && 
ac.isAllBeMemoryEnough()) {
+                QueueToken queueToken = this.waitingQueryQueue.poll();
                 if (queueToken == null) {
                     break;
                 }
                 queueToken.complete();
-                currentRunningQueryNum++;
+                runningQueryQueue.offer(queueToken);
+            }
+        } finally {
+            queueLock.unlock();
+            if (LOG.isDebugEnabled()) {
+                LOG.info(this.debugString());
+            }
+        }
+    }
+
+    public boolean notifyQuery(QueueToken queueToken) {

Review Comment:
   这个方法还有后面的那个notifySelf 都不用。
   直接用releaseAndNotify 这个,把token 传递成null,就是我们想要的逻辑。



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

Reply via email to