KYLIN-2271 Purge cube should check whether there is building segment
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/8265c3b0 Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/8265c3b0 Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/8265c3b0 Branch: refs/heads/master-cdh5.7 Commit: 8265c3b0e567e0c9ffd9d4bcb04d7ef2bbfecdbd Parents: 65c5899 Author: shaofengshi <shaofeng...@apache.org> Authored: Mon Dec 12 11:31:06 2016 +0800 Committer: shaofengshi <shaofeng...@apache.org> Committed: Mon Dec 12 11:31:06 2016 +0800 ---------------------------------------------------------------------- .../main/java/org/apache/kylin/common/KylinConfigBase.java | 5 ----- .../org/apache/kylin/rest/controller/CubeController.java | 9 +++++++-- 2 files changed, 7 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/8265c3b0/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 d4272f9..2b35c70 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 @@ -281,11 +281,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/8265c3b0/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 416fc88..4cf38e9 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 @@ -289,7 +289,7 @@ public class CubeController extends BasicController { CubeInstance cube = jobService.getCubeManager().getCube(cubeName); if (cube == null) { - throw new IllegalArgumentException("Cube with name '" + cubeName + "' was not found."); + throw new InternalErrorException("Cannot find cube " + cubeName); } return jobService.submitJob(cube, startTime, endTime, startOffset, endOffset, // sourcePartitionOffsetStart, sourcePartitionOffsetEnd, CubeBuildTypeEnum.valueOf(buildType), force, submitter); @@ -324,7 +324,12 @@ public class CubeController extends BasicController { CubeInstance cube = cubeService.getCubeManager().getCube(cubeName); if (cube == null) { - throw new InternalErrorException("Cannot find cube " + cubeName); + throw new IllegalArgumentException("Cannot find cube '" + cubeName + "'"); + } + + if (cube.getSegments() != null && cube.getBuildingSegments().size() > 0) { + int num = cube.getBuildingSegments().size(); + throw new IllegalStateException("Cannot purge cube '" + cubeName + "' as there is " + num + " building " + (num > 1 ? "segment(s)." : "segment.")); } return cubeService.purgeCube(cube);