nichunen commented on a change in pull request #840: KYLIN-4162 After the 
paragraph is dropped, continue to build the subsequent segment and provide REST 
API to resubmit the segment
URL: https://github.com/apache/kylin/pull/840#discussion_r339909741
 
 

 ##########
 File path: 
server-base/src/main/java/org/apache/kylin/rest/controller/CubeController.java
 ##########
 @@ -855,6 +863,38 @@ public CubeRequest updateCubeDesc(@RequestBody 
CubeRequest cubeRequest) throws J
 
     }
 
+    /**
+     * resubmit streaming segment
+     *
+     * @throws IOException
+     */
+    @RequestMapping(value = "/{cubeName}/segs/{segmentName}/resubmit", method 
= {RequestMethod.PUT}, produces = {"application/json"})
+    @ResponseBody
+    public void resubmitSegment(@PathVariable String cubeName, @PathVariable 
String segmentName) {
+        Coordinator coordinator = Coordinator.getInstance();
+        CubeManager cubeManager = 
CubeManager.getInstance(KylinConfig.getInstanceFromEnv());
+        CubeInstance cubeInstance = cubeManager.getCube(cubeName);
+        try {
+            Pair<Long, Long> segmentRange = 
CubeSegment.parseSegmentName(segmentName);
+            logger.info("submit streaming segment build, cube:{} segment:{}", 
cubeName, segmentName);
+            CubeSegment newSeg = 
coordinator.getCubeManager().appendSegment(cubeInstance,
+                    new TSRange(segmentRange.getFirst(), 
segmentRange.getSecond()));
+            DefaultChainedExecutable executable = new 
StreamingCubingEngine().createStreamingCubingBuilder(newSeg,
+                    "SYSTEM");
+            coordinator.getExecutableManager().addJob(executable);
+            CubingJob cubingJob = (CubingJob) executable;
+            newSeg.setLastBuildJobID(cubingJob.getId());
+
+            SegmentBuildState.BuildState state = new 
SegmentBuildState.BuildState();
+            state.setBuildStartTime(System.currentTimeMillis());
+            state.setState(SegmentBuildState.BuildState.State.BUILDING);
+            state.setJobId(cubingJob.getId());
+            streamMetadataStore.updateSegmentBuildState(cubeName, segmentName, 
state);
+        } catch (Exception e) {
+            logger.error("streaming job submit fail, cubeName:" + cubeName + " 
segment:" + segmentName, e);
 
 Review comment:
   Do not eat up the exception, throw it.

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


With regards,
Apache Git Services

Reply via email to