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

jiafengzheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris-manager.git


The following commit(s) were added to refs/heads/master by this push:
     new b2c3c77  check if user is empty when delete palo user (#24)
b2c3c77 is described below

commit b2c3c772033e91f828dd6acabff615f5958a3b61
Author: LiRui <[email protected]>
AuthorDate: Tue Mar 29 15:33:39 2022 +0800

    check if user is empty when delete palo user (#24)
    
    check if user is empty when delete palo user
---
 .../component/DorisManagerUserSpaceComponent.java  | 26 +++++++++++++---------
 .../doris/stack/connector/PaloQueryClient.java     |  4 ++++
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git 
a/manager/dm-server/src/main/java/org/apache/doris/stack/component/DorisManagerUserSpaceComponent.java
 
b/manager/dm-server/src/main/java/org/apache/doris/stack/component/DorisManagerUserSpaceComponent.java
index 5a84325..2ecc6b4 100644
--- 
a/manager/dm-server/src/main/java/org/apache/doris/stack/component/DorisManagerUserSpaceComponent.java
+++ 
b/manager/dm-server/src/main/java/org/apache/doris/stack/component/DorisManagerUserSpaceComponent.java
@@ -447,20 +447,24 @@ public class DorisManagerUserSpaceComponent extends 
BaseService {
         // delete cluster information
         clusterInfoRepository.deleteById(spaceId);
 
-        // delete cluster configuration
-        log.debug("delete cluster {} config infos.", spaceId);
-        settingComponent.deleteAdminSetting(spaceId);
+        try {
+            // delete cluster configuration
+            log.debug("delete cluster {} config infos.", spaceId);
+            settingComponent.deleteAdminSetting(spaceId);
 
-        deleteClusterPermissionInfo(clusterInfo);
+            deleteClusterPermissionInfo(clusterInfo);
 
-        // delete user information
-        log.debug("delete cluster {} all user membership.", spaceId);
-        clusterUserMembershipRepository.deleteByClusterId(spaceId);
+            // delete user information
+            log.debug("delete cluster {} all user membership.", spaceId);
+            clusterUserMembershipRepository.deleteByClusterId(spaceId);
 
-        // TODO: In order to be compatible with the deleted content of spatial 
information before, it is put here.
-        //  If the interface that releases both cluster and physical resources 
is implemented later,
-        //  it will be unified in the current doriscluster processing operation
-        clusterManager.deleteClusterOperation(clusterInfo);
+            // TODO: In order to be compatible with the deleted content of 
spatial information before, it is put here.
+            //  If the interface that releases both cluster and physical 
resources is implemented later,
+            //  it will be unified in the current doriscluster processing 
operation
+            clusterManager.deleteClusterOperation(clusterInfo);
+        } catch (Exception e) {
+            log.warn("delete space {} related information failed", spaceId, e);
+        }
     }
 
     private void deleteClusterPermissionInfo(ClusterInfoEntity clusterInfo) 
throws Exception {
diff --git 
a/manager/manager/src/main/java/org/apache/doris/stack/connector/PaloQueryClient.java
 
b/manager/manager/src/main/java/org/apache/doris/stack/connector/PaloQueryClient.java
index a678c80..d43720f 100644
--- 
a/manager/manager/src/main/java/org/apache/doris/stack/connector/PaloQueryClient.java
+++ 
b/manager/manager/src/main/java/org/apache/doris/stack/connector/PaloQueryClient.java
@@ -77,6 +77,10 @@ public class PaloQueryClient extends PaloClient {
     }
 
     public void deleteUser(String ns, String db, ClusterInfoEntity entity, 
String userName) {
+        if (userName == null) {
+            log.warn("user name is null");
+            return;
+        }
         if (userName.startsWith("Analyzer") || 
userName.startsWith("Administrators")) {
             try {
                 String deleteSql = "DROP USER '" + userName + "'@'%'";

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to