You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by "vernedeng (via GitHub)" <gi...@apache.org> on 2023/09/04 06:20:46 UTC

[GitHub] [inlong] vernedeng commented on a diff in pull request #8831: [INLONG-8805][Manager] Check tenant status before deleting tenant

vernedeng commented on code in PR #8831:
URL: https://github.com/apache/inlong/pull/8831#discussion_r1314479098


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/tenant/InlongTenantServiceImpl.java:
##########
@@ -156,6 +167,32 @@ public Boolean delete(String name) {
         String operator = LoginUserUtils.getLoginUser().getName();
         log.info("begin to delete inlong tenant name={} by user={}", name, operator);
         InlongTenantEntity inlongTenantEntity = inlongTenantEntityMapper.selectByName(name);
+        // before deleting a tenant, check if all Groups of the tenant are in stop status
+        List<InlongGroupEntity> groupList = groupMapper.selectByTenant(name);
+        long notStopGroupCount =
+                groupList.stream().filter(
+                        group -> !GroupStatus.DELETED.getCode().equals(group.getStatus()) || group.getIsDeleted() == 0)
+                        .count();
+        if (notStopGroupCount > 0) {
+            String errMsg = String.format(

Review Comment:
   Please log out all groups that are not in stop or deleted status



-- 
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@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org