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 2016/12/12 03:35:38 UTC

kylin git commit: KYLIN-2271 Purge cube may delete building segments

Repository: kylin
Updated Branches:
  refs/heads/yang22 9d2d7aef8 -> 43a9226a6


KYLIN-2271 Purge cube may delete building segments


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/43a9226a
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/43a9226a
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/43a9226a

Branch: refs/heads/yang22
Commit: 43a9226a657f29099bf9b698a2e5eb69d6fd3e31
Parents: 9d2d7ae
Author: shaofengshi <sh...@apache.org>
Authored: Mon Dec 12 11:31:06 2016 +0800
Committer: shaofengshi <sh...@apache.org>
Committed: Mon Dec 12 11:35:29 2016 +0800

----------------------------------------------------------------------
 .../java/org/apache/kylin/common/KylinConfigBase.java    |  5 -----
 .../org/apache/kylin/rest/controller/CubeController.java | 11 ++++++++++-
 2 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/43a9226a/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java
----------------------------------------------------------------------
diff --git a/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java b/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java
index f46c185..9923bc1 100644
--- a/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java
+++ b/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java
@@ -290,11 +290,6 @@ abstract public class KylinConfigBase implements Serializable {
         return Boolean.parseBoolean(getOptional("kylin.cube.ignore-signature-inconsistency", "false"));
     }
 
-    @Deprecated
-    public int getCubeAggrGroupMaxSize() {
-        return Integer.parseInt(getOptional("kylin.cube.aggrgroup.max-size", "12"));
-    }
-
     public int getCubeAggrGroupMaxCombination() {
         return Integer.parseInt(getOptional("kylin.cube.aggrgroup.max-combination", "4096"));
     }

http://git-wip-us.apache.org/repos/asf/kylin/blob/43a9226a/server-base/src/main/java/org/apache/kylin/rest/controller/CubeController.java
----------------------------------------------------------------------
diff --git a/server-base/src/main/java/org/apache/kylin/rest/controller/CubeController.java b/server-base/src/main/java/org/apache/kylin/rest/controller/CubeController.java
index d98f78f..da08860 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/controller/CubeController.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/controller/CubeController.java
@@ -299,6 +299,10 @@ public class CubeController extends BasicController {
         try {
             String submitter = SecurityContextHolder.getContext().getAuthentication().getName();
             CubeInstance cube = jobService.getCubeManager().getCube(cubeName);
+
+            if (cube == null) {
+                throw new InternalErrorException("Cannot find cube '" + cubeName + "'");
+            }
             return jobService.submitJob(cube, startTime, endTime, startOffset, endOffset, //
                     sourcePartitionOffsetStart, sourcePartitionOffsetEnd, CubeBuildTypeEnum.valueOf(buildType), force, submitter);
         } catch (Exception e) {
@@ -332,7 +336,12 @@ public class CubeController extends BasicController {
             CubeInstance cube = cubeService.getCubeManager().getCube(cubeName);
 
             if (cube == null) {
-                throw new InternalErrorException("Cannot find cube " + cubeName);
+                throw new InternalErrorException("Cannot find cube '" + cubeName + "'");
+            }
+
+            if (cube.getSegments() != null && cube.getBuildingSegments().size() > 0) {
+                int num = cube.getBuildingSegments().size();
+                throw new InternalErrorException("Cannot purge cube '" + cubeName + "' as there is " + num + " building " + (num > 1 ? "segment(s)." : "segment."));
             }
 
             return cubeService.purgeCube(cube);