You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2015/09/18 11:53:01 UTC
incubator-kylin git commit: KYLIN-1031 Fix the way to check
Build+Merge in UpdateCubeInfoAfterBuildStep
Repository: incubator-kylin
Updated Branches:
refs/heads/2.x-staging df03c53fb -> 37fa541af
KYLIN-1031 Fix the way to check Build+Merge in UpdateCubeInfoAfterBuildStep
Project: http://git-wip-us.apache.org/repos/asf/incubator-kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-kylin/commit/37fa541a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kylin/tree/37fa541a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kylin/diff/37fa541a
Branch: refs/heads/2.x-staging
Commit: 37fa541af99e838cdf089cead4e5920211b6a108
Parents: df03c53
Author: Li, Yang <ya...@ebay.com>
Authored: Fri Sep 18 17:52:49 2015 +0800
Committer: Li, Yang <ya...@ebay.com>
Committed: Fri Sep 18 17:52:49 2015 +0800
----------------------------------------------------------------------
.../mr/steps/UpdateCubeInfoAfterBuildStep.java | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/37fa541a/engine-mr/src/main/java/org/apache/kylin/engine/mr/steps/UpdateCubeInfoAfterBuildStep.java
----------------------------------------------------------------------
diff --git a/engine-mr/src/main/java/org/apache/kylin/engine/mr/steps/UpdateCubeInfoAfterBuildStep.java b/engine-mr/src/main/java/org/apache/kylin/engine/mr/steps/UpdateCubeInfoAfterBuildStep.java
index bc6d900..f3cf6f5 100644
--- a/engine-mr/src/main/java/org/apache/kylin/engine/mr/steps/UpdateCubeInfoAfterBuildStep.java
+++ b/engine-mr/src/main/java/org/apache/kylin/engine/mr/steps/UpdateCubeInfoAfterBuildStep.java
@@ -76,7 +76,6 @@ public class UpdateCubeInfoAfterBuildStep extends AbstractExecutable {
long sourceCount = cubingJob.findSourceRecordCount();
long sourceSizeBytes = cubingJob.findSourceSizeBytes();
long cubeSizeBytes = cubingJob.findCubeSizeBytes();
- boolean segmentReady = cubeSizeBytes > 0; // for build+merge scenario, convert HFile not happen yet, so cube size is 0
segment.setLastBuildJobID(getCubingJobId());
segment.setLastBuildTime(System.currentTimeMillis());
@@ -85,12 +84,13 @@ public class UpdateCubeInfoAfterBuildStep extends AbstractExecutable {
segment.setInputRecordsSize(sourceSizeBytes);
try {
- if (segmentReady) {
- cubeManager.promoteNewlyBuiltSegments(cube, segment);
- } else {
+ if (isBuildAndMerge(cubingJob)) {
+ // don't mark the segment ready yet, it's going to be merged right after
CubeUpdate cubeBuilder = new CubeUpdate(cube);
cubeBuilder.setToUpdateSegs(segment);
cubeManager.updateCube(cubeBuilder);
+ } else {
+ cubeManager.promoteNewlyBuiltSegments(cube, segment);
}
return new ExecuteResult(ExecuteResult.State.SUCCEED, "succeed");
} catch (IOException e) {
@@ -98,4 +98,12 @@ public class UpdateCubeInfoAfterBuildStep extends AbstractExecutable {
return new ExecuteResult(ExecuteResult.State.ERROR, e.getLocalizedMessage());
}
}
+
+ private boolean isBuildAndMerge(CubingJob cubingJob) {
+ for (AbstractExecutable task : cubingJob.getTasks()) {
+ if (task instanceof UpdateCubeInfoAfterMergeStep)
+ return true;
+ }
+ return false;
+ }
}