kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From billy...@apache.org
Subject kylin git commit: KYLIN-2263 display reasonable message when could not load kafka dependency
Date Fri, 09 Dec 2016 06:32:33 GMT
Repository: kylin
Updated Branches:
  refs/heads/yang22 7a9273ab7 -> 25bbb30b9


KYLIN-2263 display reasonable message when could not load kafka dependency


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

Branch: refs/heads/yang22
Commit: 25bbb30b9ec5e52c93c111da3140ad7c302c3a58
Parents: 7a9273a
Author: Billy Liu <billyliu@apache.org>
Authored: Fri Dec 9 14:31:52 2016 +0800
Committer: Billy Liu <billyliu@apache.org>
Committed: Fri Dec 9 14:32:25 2016 +0800

----------------------------------------------------------------------
 .../kylin/rest/controller/CubeController.java   | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/25bbb30b/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 4c07f7c..d98f78f 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
@@ -271,14 +271,26 @@ public class CubeController extends BasicController {
     /** Build/Rebuild a cube segment by source offset */
     @RequestMapping(value = "/{cubeName}/build2", method = { RequestMethod.PUT })
     @ResponseBody
-    public JobInstance build(@PathVariable String cubeName, @RequestBody JobBuildRequest2
req) {
-        return rebuild(cubeName, req);
+    public JobInstance build2(@PathVariable String cubeName, @RequestBody JobBuildRequest2
req) {
+        boolean existKafkaClient = false;
+        try {
+            Class<?> clazz = Class.forName("org.apache.kafka.clients.consumer.KafkaConsumer");
+            if (clazz != null) {
+                existKafkaClient = true;
+            }
+        } catch (ClassNotFoundException e) {
+            existKafkaClient = false;
+        }
+        if (!existKafkaClient) {
+            throw new InternalErrorException("Could not find Kafka dependency");
+        }
+        return rebuild2(cubeName, req);
     }
 
     /** Build/Rebuild a cube segment by source offset */
     @RequestMapping(value = "/{cubeName}/rebuild2", method = { RequestMethod.PUT })
     @ResponseBody
-    public JobInstance rebuild(@PathVariable String cubeName, @RequestBody JobBuildRequest2
req) {
+    public JobInstance rebuild2(@PathVariable String cubeName, @RequestBody JobBuildRequest2
req) {
         return buildInternal(cubeName, 0, 0, req.getSourceOffsetStart(), req.getSourceOffsetEnd(),
req.getSourcePartitionOffsetStart(), req.getSourcePartitionOffsetEnd(), req.getBuildType(),
req.isForce());
     }
 
@@ -587,7 +599,7 @@ public class CubeController extends BasicController {
                 request.setSourceOffsetEnd(hole.getSourceOffsetEnd());
                 request.setSourcePartitionOffsetEnd(hole.getSourcePartitionOffsetEnd());
                 try {
-                    JobInstance job = build(cubeName, request);
+                    JobInstance job = build2(cubeName, request);
                     jobs.add(job);
                 } catch (Exception e) {
                     // it may exceed the max allowed job number


Mime
View raw message