mansonliwh commented on code in PR #3457:
URL: https://github.com/apache/amoro/pull/3457#discussion_r1992878735
##########
amoro-ams/src/main/java/org/apache/amoro/server/resource/DefaultOptimizerManager.java:
##########
@@ -125,4 +149,35 @@ public List<Resource> listResourcesByGroup(String
groupName) {
public Resource getResource(String resourceId) {
return getAs(ResourceMapper.class, mapper ->
mapper.selectResource(resourceId));
}
+
+ @Override
+ public boolean canDeleteResourceGroup(String name) {
+ for (CatalogMeta catalogMeta : catalogManager.listCatalogMetas()) {
+ if (catalogMeta.getCatalogProperties() != null
+ && catalogMeta
+ .getCatalogProperties()
+ .getOrDefault(
+ CatalogMetaProperties.TABLE_PROPERTIES_PREFIX
+ + TableProperties.SELF_OPTIMIZING_GROUP,
+ TableProperties.SELF_OPTIMIZING_GROUP_DEFAULT)
+ .equals(name)) {
+ return false;
+ }
+ }
+ for (OptimizerInstance optimizer : listOptimizers()) {
+ if (optimizer.getGroupName().equals(name)) {
+ return false;
+ }
+ }
+ List<String> tableRuntimeMetas =
+ getAs(
+ TableMetaMapper.class,
+ mapper -> mapper.selectTableRuntimeNamesForOptimizerGroup(name,
null, null, null));
+ for (ServerTableIdentifier identifier : tableManager.listManagedTables()) {
Review Comment:
Thanks for your guidance, I have adopted the ideas you provided.
--
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]