You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2021/07/06 11:46:49 UTC

[GitHub] [incubator-doris] morningman commented on a change in pull request #6159: Add a property to limit user instance num.

morningman commented on a change in pull request #6159:
URL: https://github.com/apache/incubator-doris/pull/6159#discussion_r664426679



##########
File path: fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/UserProperty.java
##########
@@ -74,6 +72,9 @@
     private String qualifiedUser;
 
     private long maxConn = 100;
+
+    private long maxQueryInstances = -1;

Review comment:
       We can create a new class and put all user property in it. And using json to serialize it. So that we don't need to update the meta version each time we add a new property in future.

##########
File path: fe/fe-core/src/main/java/org/apache/doris/qe/QeProcessorImpl.java
##########
@@ -79,10 +88,58 @@ public void registerQuery(TUniqueId queryId, QueryInfo info) throws UserExceptio
         }
     }
 
+    public void registerInstances(TUniqueId queryId, Integer instancesNum) throws UserException {
+        if (!coordinatorMap.containsKey(queryId)) {
+            throw new UserException("query not exists in coordinatorMap:" + DebugUtil.printId(queryId));
+        }
+        QueryInfo queryInfo = coordinatorMap.get(queryId);
+        if (queryInfo.getConnectContext() != null &&
+                !Strings.isNullOrEmpty(queryInfo.getConnectContext().getQualifiedUser())
+        ) {
+            String user = queryInfo.getConnectContext().getQualifiedUser();
+            long maxQueryInstances = queryInfo.getConnectContext().getCatalog().getAuth().getMaxQueryInstances(user);

Review comment:
       `maxQueryInstances` can be saved in ConnectionContext when connection established, so that no need to calculate this variables at every `registerInstances()`




-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org