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/05 13:13:43 UTC

[GitHub] [incubator-doris] liutang123 opened a new pull request #6159: Add a property to limit user instance num.

liutang123 opened a new pull request #6159:
URL: https://github.com/apache/incubator-doris/pull/6159


   ## Proposed changes
   
   Add a property to limit user instance num.
   
   ## Types of changes
   
   What types of changes does your code introduce to Doris?
   _Put an `x` in the boxes that apply_
   
   - [ ] Bugfix (non-breaking change which fixes an issue)
   - [x] New feature (non-breaking change which adds functionality)
   - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
   - [x] Documentation Update (if none of the other choices apply)
   - [ ] Code refactor (Modify the code structure, format the code, etc...)
   
   ## Checklist
   
   _Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._
   
   - [x] I have created an issue on (Fix #6158) and described the bug/feature there in detail
   - [x] Compiling and unit tests pass locally with my changes
   - [x] I have added tests that prove my fix is effective or that my feature works
   - [x] If these changes need document changes, I have updated the document
   - [ ] Any dependent changes have been merged
   
   ## Further comments
   
   


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


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

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #6159:
URL: https://github.com/apache/incubator-doris/pull/6159#discussion_r666679248



##########
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:
       I made a test, in high concurrency scenarios, QPS has a drop of about 10% (from 11000/s to 10000/s)
   But I think its OK for most cases.




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


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

Posted by GitBox <gi...@apache.org>.
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


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

Posted by GitBox <gi...@apache.org>.
liutang123 commented on a change in pull request #6159:
URL: https://github.com/apache/incubator-doris/pull/6159#discussion_r665517707



##########
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:
       If save `maxQueryInstances` in `ConnectionContext `, we can not change it after `ConnectionContext` created.
   `getMaxQueryInstances` will try to obtain an read lock in PlaoAuth. I think the cost should be very small, because it is a situation of reading more and writing less.
   
   However, we can update parameters and disconnect all links to make parameters take effect.




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


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

Posted by GitBox <gi...@apache.org>.
morningman merged pull request #6159:
URL: https://github.com/apache/incubator-doris/pull/6159


   


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