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


##########
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()) {

Review Comment:
   这里继续调用 ac 的checkResourceAvailable 方法



##########
fe/fe-core/src/main/java/org/apache/doris/resource/workloadgroup/QueryQueue.java:
##########
@@ -105,18 +104,31 @@ public QueueToken getToken() throws UserException {
             if (LOG.isDebugEnabled()) {
                 LOG.info(this.debugString());
             }
-            if (currentRunningQueryNum < maxConcurrency) {
+            AdmissionControl admissionControl = 
Env.getCurrentEnv().getAdmissionControl();

Review Comment:
   把这堆根据resource 判断是否可以运行的逻辑,移动到adminsion control中。比如增加一个方法,boolean 
checkResourceAvailable(QueryToken) , 如果不能运行,那么admission controll 
直接设置token的状态,同时设置message. 否则,后期我们逻辑越来越复杂,这个代码会很大。



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