kylin-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KYLIN-3640) CUBE DESCBROKEN
Date Mon, 22 Oct 2018 19:14:00 GMT

    [ https://issues.apache.org/jira/browse/KYLIN-3640?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16659450#comment-16659450
] 

ASF GitHub Bot commented on KYLIN-3640:
---------------------------------------

shaofengshi closed pull request #300: KYLIN-3640 Fix cube with desc broken state can not be
deleted
URL: https://github.com/apache/kylin/pull/300
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java b/core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java
index c4ed337285..4838e3c7e0 100644
--- a/core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java
+++ b/core-cube/src/main/java/org/apache/kylin/cube/model/CubeDesc.java
@@ -1498,7 +1498,20 @@ public boolean isShrunkenDictFromGlobalEnabled() {
     }
 
     public String getProject() {
-        return getModel().getProject();
+        DataModelDesc modelDesc = getModel();
+        if (modelDesc == null) {
+            // In case the model for cube not exists in metadata
+            List<ProjectInstance> ownerPrj = ProjectManager.getInstance(config).findProjects(RealizationType.CUBE,
+                    name);
+
+            if (ownerPrj.size() == 1) {
+                return ownerPrj.get(0).getName();
+            } else {
+                throw new IllegalStateException("No project found for cube " + name);
+            }
+        } else {
+            return getModel().getProject();
+        }
     }
 
     public static CubeDesc getCopyOf(CubeDesc cubeDesc) {
diff --git a/server/src/test/java/org/apache/kylin/rest/controller/CubeControllerTest.java
b/server/src/test/java/org/apache/kylin/rest/controller/CubeControllerTest.java
index d30391b2e0..2691aa9c21 100644
--- a/server/src/test/java/org/apache/kylin/rest/controller/CubeControllerTest.java
+++ b/server/src/test/java/org/apache/kylin/rest/controller/CubeControllerTest.java
@@ -27,6 +27,7 @@
 import org.apache.kylin.cube.model.CubeDesc;
 import org.apache.kylin.cube.model.DimensionDesc;
 import org.apache.kylin.metadata.model.SegmentRange.TSRange;
+import org.apache.kylin.metadata.realization.RealizationStatusEnum;
 import org.apache.kylin.rest.exception.InternalErrorException;
 import org.apache.kylin.rest.exception.NotFoundException;
 import org.apache.kylin.rest.request.CubeRequest;
@@ -228,4 +229,15 @@ public void testGetSql() {
         }
     }
 
+    @Test
+    public void tesDeleteDescBrokenCube() throws Exception {
+        final String cubeName = "ci_left_join_cube";
+        CubeInstance cubeInstance = cubeService.getCubeManager().getCube(cubeName);
+        CubeDesc cubeDesc = cubeInstance.getDescriptor();
+        cubeDesc.setModel(null);
+        cubeInstance.setStatus(RealizationStatusEnum.DESCBROKEN);
+        cubeController.deleteCube(cubeName);
+        Assert.assertNull(cubeService.getCubeManager().getCube(cubeName));
+    }
+
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> CUBE DESCBROKEN
> ---------------
>
>                 Key: KYLIN-3640
>                 URL: https://issues.apache.org/jira/browse/KYLIN-3640
>             Project: Kylin
>          Issue Type: Bug
>          Components: Metadata
>    Affects Versions: v2.4.1
>         Environment: kylin2.5
>            Reporter: shenqiong
>            Assignee: nichunen
>            Priority: Major
>
> After change a referenced source data table columns,such as delete some columns, the
model used the table is auto deleted, but the cube under the mode is broken, with status of
"DESCBROKEN" . besides, the broken cube can not be deleted , throw out null error!



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message