luozenglin commented on code in PR #20048:
URL: https://github.com/apache/doris/pull/20048#discussion_r1205351863


##########
fe/fe-core/src/main/java/org/apache/doris/resource/resourcegroup/ResourceGroup.java:
##########
@@ -85,11 +97,54 @@ private ResourceGroup(long id, String name, Map<String, 
String> properties, long
         }
     }
 
+    // called when first create a resource group, load from image or user new 
create a group
+    public void initQueryQueue() {
+        resetQueueProperty(properties);
+        // if query queue property is not set, when use default value
+        this.queryQueue = new QueryQueue(maxConcurrency, maxQueueSize, 
queueTimeout);
+    }
+
+    void resetQueryQueue(QueryQueue queryQueue) {
+        resetQueueProperty(properties);
+        this.queryQueue = queryQueue;
+        this.queryQueue.resetQueueProperty(this.maxConcurrency, 
this.maxQueueSize, this.queueTimeout);
+
+    }
+
+    private void resetQueueProperty(Map<String, String> properties) {
+        if (properties.containsKey(MAX_CONCURRENCY)) {
+            this.maxConcurrency = 
Integer.parseInt(properties.get(MAX_CONCURRENCY));
+        } else {
+            this.maxConcurrency = Integer.MAX_VALUE;
+            properties.put(MAX_CONCURRENCY, 
String.valueOf(this.maxConcurrency));

Review Comment:
   Even if the user does not enable the query queue feature, he can still see 
the query queue related properties when using show resource groups, which may 
confuse the user.



##########
fe/fe-core/src/main/java/org/apache/doris/resource/resourcegroup/ResourceGroup.java:
##########
@@ -141,6 +201,23 @@ private static void checkProperties(Map<String, String> 
properties) throws DdlEx
                 throw new DdlException("The value of '" + 
ENABLE_MEMORY_OVERCOMMIT + "' must be true or false.");
             }
         }
+
+        // check queue property
+        if (properties.containsKey(MAX_CONCURRENCY)) {
+            if (Integer.parseInt(properties.get(MAX_CONCURRENCY)) < 0) {

Review Comment:
   Integer.parseInt may throw an exception, make sure the upper layer catches 
this exception and gives a user-friendly message



##########
fe/fe-core/src/main/java/org/apache/doris/resource/resourcegroup/ResourceGroupMgr.java:
##########
@@ -114,6 +114,32 @@ public List<TPipelineResourceGroup> 
getResourceGroup(String groupName) throws Us
         return resourceGroups;
     }
 
+    public QueryQueue getResourceGroupQueryQueue(String groupName) throws 
UserException {
+        readLock();
+        try {
+            ResourceGroup resourceGroup = nameToResourceGroup.get(groupName);
+            if (resourceGroup == null) {
+                throw new UserException("Resource group " + groupName + " does 
not exist");
+            }
+            return resourceGroup.getQueryQueue();
+        } finally {
+            readUnlock();
+        }
+    }
+
+    // called after group loaded from image
+    // currently mainly used to init Resource Group's query queue
+    public void initResourceGroup() {

Review Comment:
   It might be better to call this function in gsonPostProcess()



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