wangbo commented on code in PR #18990:
URL: https://github.com/apache/doris/pull/18990#discussion_r1178541166
##########
fe/fe-core/src/main/java/org/apache/doris/resource/resourcegroup/ResourceGroupMgr.java:
##########
@@ -151,10 +155,30 @@ public void createResourceGroup(CreateResourceGroupStmt
stmt) throws DdlExceptio
LOG.info("Create resource group success: {}", resourceGroup);
}
- public void dropResourceGroup(DropResourceGroupStmt stmt) throws
DdlException {
- if (!Config.enable_resource_group) {
- throw new DdlException("unsupported feature now, coming soon.");
+ public void alterResourceGroup(AlterResourceGroupStmt stmt) throws
DdlException {
+ checkResourceGroupEnabled();
+
+ String resourceGroupName = stmt.getResourceGroupName();
+ Map<String, String> properties = stmt.getProperties();
+ ResourceGroup newResourceGroup;
+ writeLock();
+ try {
+ if (!nameToResourceGroup.containsKey(resourceGroupName)) {
+ throw new DdlException("Resource Group(" + resourceGroupName +
") does not exist.");
+ }
+ ResourceGroup resourceGroup =
nameToResourceGroup.get(resourceGroupName);
+ newResourceGroup = ResourceGroup.create(resourceGroup, properties);
+ nameToResourceGroup.put(resourceGroupName, newResourceGroup);
Review Comment:
It seems that currently we not support partial attribute alter group.
Need a todo here/
##########
fe/fe-core/src/main/java/org/apache/doris/resource/resourcegroup/ResourceGroupMgr.java:
##########
@@ -151,10 +155,30 @@ public void createResourceGroup(CreateResourceGroupStmt
stmt) throws DdlExceptio
LOG.info("Create resource group success: {}", resourceGroup);
}
- public void dropResourceGroup(DropResourceGroupStmt stmt) throws
DdlException {
- if (!Config.enable_resource_group) {
- throw new DdlException("unsupported feature now, coming soon.");
+ public void alterResourceGroup(AlterResourceGroupStmt stmt) throws
DdlException {
+ checkResourceGroupEnabled();
+
+ String resourceGroupName = stmt.getResourceGroupName();
+ Map<String, String> properties = stmt.getProperties();
+ ResourceGroup newResourceGroup;
+ writeLock();
+ try {
+ if (!nameToResourceGroup.containsKey(resourceGroupName)) {
+ throw new DdlException("Resource Group(" + resourceGroupName +
") does not exist.");
+ }
+ ResourceGroup resourceGroup =
nameToResourceGroup.get(resourceGroupName);
+ newResourceGroup = ResourceGroup.create(resourceGroup, properties);
+ nameToResourceGroup.put(resourceGroupName, newResourceGroup);
Review Comment:
It seems that currently we not support partial attribute alter group.
Need a todo here.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]