[fix](user-property) Fix bug that can not set exec_mem_limit at user level (#8710)

This commit is contained in:
Mingyu Chen
2022-03-29 10:03:33 +08:00
committed by GitHub
parent 365eba0b92
commit d82c138a60
2 changed files with 21 additions and 1 deletions

View File

@ -329,7 +329,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;
@ -452,6 +452,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())));

View File

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