This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch dev-1.0.0
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git

commit 34df01a414d159fb099c24706de4f53f22750c79
Author: Mingyu Chen <morningman....@gmail.com>
AuthorDate: Tue Mar 29 10:03:33 2022 +0800

    [fix](user-property) Fix bug that can not set exec_mem_limit at user level 
(#8710)
---
 .../org/apache/doris/mysql/privilege/UserProperty.java     |  8 +++++++-
 .../org/apache/doris/planner/ResourceTagQueryTest.java     | 14 ++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/UserProperty.java 
b/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/UserProperty.java
index 04c5b0a..e21dbf7 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/UserProperty.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/UserProperty.java
@@ -332,7 +332,7 @@ public class UserProperty implements Writable {
         this.commonProperties.setCpuResourceLimit(cpuResourceLimit);
         this.commonProperties.setResourceTags(resourceTags);
         this.commonProperties.setExecMemLimit(execMemLimit);
-        this.commonProperties.setExecMemLimit(loadMemLimit);
+        this.commonProperties.setLoadMemLimit(loadMemLimit);
         resource = newResource;
         if (newDppConfigs.containsKey(newDefaultLoadCluster)) {
             defaultLoadCluster = newDefaultLoadCluster;
@@ -455,6 +455,12 @@ public class UserProperty implements Writable {
         // cpu resource limit
         result.add(Lists.newArrayList(PROP_CPU_RESOURCE_LIMIT, 
String.valueOf(commonProperties.getCpuResourceLimit())));
 
+        // exec mem limit
+        result.add(Lists.newArrayList(PROP_EXEC_MEM_LIMIT, 
String.valueOf(commonProperties.getExecMemLimit())));
+
+        // load mem limit
+        result.add(Lists.newArrayList(PROP_LOAD_MEM_LIMIT, 
String.valueOf(commonProperties.getLoadMemLimit())));
+
         // resource tag
         result.add(Lists.newArrayList(PROP_RESOURCE_TAGS, Joiner.on(", 
").join(commonProperties.getResourceTags())));
 
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/planner/ResourceTagQueryTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/planner/ResourceTagQueryTest.java
index 8ab9ab7..e43c672 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/planner/ResourceTagQueryTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/planner/ResourceTagQueryTest.java
@@ -271,6 +271,20 @@ public class ResourceTagQueryTest {
         explainString = UtFrameUtils.getSQLPlanOrErrorMsg(connectContext, 
queryStr);
         System.out.println(explainString);
         Assert.assertTrue(explainString.contains("tabletRatio=30/30"));
+
+        // set user exec mem limit
+        String setExecMemLimitStr = "set property for 'root' 'exec_mem_limit' 
= '1000000';";
+        ExceptionChecker.expectThrowsNoException(() -> 
setProperty(setExecMemLimitStr));
+        long execMemLimit = 
Catalog.getCurrentCatalog().getAuth().getExecMemLimit(PaloAuth.ROOT_USER);
+        Assert.assertEquals(1000000, execMemLimit);
+
+        String setLoadMemLimitStr = "set property for 'root' 'load_mem_limit' 
= '2000000';";
+        ExceptionChecker.expectThrowsNoException(() -> 
setProperty(setLoadMemLimitStr));
+        long loadMemLimit = 
Catalog.getCurrentCatalog().getAuth().getLoadMemLimit(PaloAuth.ROOT_USER);
+        Assert.assertEquals(2000000, loadMemLimit);
+
+        List<List<String>> userProps = 
Catalog.getCurrentCatalog().getAuth().getUserProperties(PaloAuth.ROOT_USER);
+        Assert.assertEquals(17, userProps.size());
     }
 
     private void checkTableReplicaAllocation(OlapTable tbl) throws 
InterruptedException {

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

Reply via email to