You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by sh...@apache.org on 2018/10/25 06:16:51 UTC

[kylin] 01/02: KYLIN-3645 clean table metadata when drop project

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

shaofengshi pushed a commit to branch 2.5.x
in repository https://gitbox.apache.org/repos/asf/kylin.git

commit 42c7338f141429bb1f98ad93e8c23359f4a699a9
Author: Rongchuan Jin <ro...@RongchuanJins-MacBook-Pro.local>
AuthorDate: Wed Oct 24 10:56:21 2018 +0800

    KYLIN-3645 clean table metadata when drop project
---
 .../java/org/apache/kylin/rest/service/ProjectService.java    | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/server-base/src/main/java/org/apache/kylin/rest/service/ProjectService.java b/server-base/src/main/java/org/apache/kylin/rest/service/ProjectService.java
index 7d56fff..22ee95e 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/service/ProjectService.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/service/ProjectService.java
@@ -23,9 +23,8 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.LinkedHashMap;
 import java.util.List;
-
+import java.util.Set;
 import javax.annotation.Nullable;
-
 import org.apache.directory.api.util.Strings;
 import org.apache.kylin.metadata.project.ProjectInstance;
 import org.apache.kylin.metadata.realization.RealizationType;
@@ -68,6 +67,9 @@ public class ProjectService extends BasicService {
     @Autowired
     private AclEvaluate aclEvaluate;
 
+    @Autowired
+    private TableService tableService;
+
     @PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN)
     public ProjectInstance createProject(ProjectInstance newProject) throws IOException {
         Message msg = MsgPicker.getMsg();
@@ -131,8 +133,11 @@ public class ProjectService extends BasicService {
 
     @PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN)
     public void deleteProject(String projectName, ProjectInstance project) throws IOException {
+        Set<String> tables = project.getTables();
+        for (String table : tables) {
+            tableService.unloadHiveTable(table, projectName);
+        }
         getProjectManager().dropProject(projectName);
-
         accessService.clean(project, true);
     }