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 2018/09/11 00:47:12 UTC

[kylin] 04/06: KYLIN-3518 Fix Coprocessor NPE problem on hbase 2

This is an automated email from the ASF dual-hosted git repository.

shaofengshi pushed a commit to branch master-hadoop3.1
in repository https://gitbox.apache.org/repos/asf/kylin.git

commit 00e8bd7be00296533414e2a869b18ee855fa89da
Author: Lijun Cao <>
AuthorDate: Thu Aug 30 09:28:54 2018 +0800

    KYLIN-3518 Fix Coprocessor NPE problem on hbase 2
---
 build/deploy/server.xml                              |  2 +-
 build/script/elimate-jar-conflict.sh                 | 20 ++++++++++++++++++++
 build/script/prepare.sh                              |  3 +++
 .../v2/coprocessor/endpoint/CubeVisitService.java    | 10 +++++-----
 4 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/build/deploy/server.xml b/build/deploy/server.xml
index 96f329b..920be25 100644
--- a/build/deploy/server.xml
+++ b/build/deploy/server.xml
@@ -26,7 +26,7 @@
     <!--APR library loader. Documentation at /docs/apr.html -->
     <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
     <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
-    <Listener className="org.apache.catalina.core.JasperListener" />
+    <!-- <Listener className="org.apache.catalina.core.JasperListener" /> -->
     <!-- Prevent memory leaks due to use of particular java/javax APIs-->
     <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
     <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
diff --git a/build/script/elimate-jar-conflict.sh b/build/script/elimate-jar-conflict.sh
new file mode 100644
index 0000000..d02a874
--- /dev/null
+++ b/build/script/elimate-jar-conflict.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+
+current_dir=`pwd`
+cd ${current_dir}/build/tomcat/webapps
+unzip kylin.war && rm -f kylin.war
+cd WEB-INF/lib
+#remove slf4j-api-1.7.21.jar to solve slf4j conflict
+rm -f slf4j-api-1.7.21.jar
+mkdir modify_avatica_jar && mv avatica-1.10.0.jar modify_avatica_jar
+cd modify_avatica_jar
+#remove org/slf4j in avatica-1.10.0.jar and repackage it to solve slf4j conflict
+unzip avatica-1.10.0.jar && rm -f avatica-1.10.0.jar
+rm -rf org/slf4j && jar -cf avatica-1.10.0.jar ./
+rm -rf `ls | egrep -v avatica-1.10.0.jar`
+mv avatica-1.10.0.jar ..
+cd .. && rm -rf modify_avatica_jar
+cd ${current_dir}/build/tomcat/webapps
+#repackage kylin.war
+jar -cf kylin.war ./ && rm -rf `ls | egrep -v kylin.war`
+cd ${current_dir}
\ No newline at end of file
diff --git a/build/script/prepare.sh b/build/script/prepare.sh
index deaf58d..be9dd9d 100755
--- a/build/script/prepare.sh
+++ b/build/script/prepare.sh
@@ -31,6 +31,9 @@ export version
 sh build/script/prepare-libs.sh || { exit 1; }
 
 cp server/target/kylin-server-${version}.war build/tomcat/webapps/kylin.war
+
+sh build/script/elimate-jar-conflict.sh
+
 chmod 644 build/tomcat/webapps/kylin.war
 
 echo "add js css to war"
diff --git a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/cube/v2/coprocessor/endpoint/CubeVisitService.java b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/cube/v2/coprocessor/endpoint/CubeVisitService.java
index ded3500..2beddc7 100644
--- a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/cube/v2/coprocessor/endpoint/CubeVisitService.java
+++ b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/cube/v2/coprocessor/endpoint/CubeVisitService.java
@@ -24,6 +24,7 @@ import java.lang.management.ManagementFactory;
 import java.net.InetAddress;
 import java.nio.BufferOverflowException;
 import java.nio.ByteBuffer;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
@@ -31,12 +32,11 @@ import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.ArrayUtils;
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.CellUtil;
-import org.apache.hadoop.hbase.Coprocessor;
 import org.apache.hadoop.hbase.CoprocessorEnvironment;
 import org.apache.hadoop.hbase.DoNotRetryIOException;
 import org.apache.hadoop.hbase.client.Scan;
 import org.apache.hadoop.hbase.coprocessor.CoprocessorException;
-import org.apache.hadoop.hbase.coprocessor.CoprocessorService;
+import org.apache.hadoop.hbase.coprocessor.RegionCoprocessor;
 import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
 import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.regionserver.RegionScanner;
@@ -78,7 +78,7 @@ import com.sun.management.OperatingSystemMXBean;
 
 @SuppressWarnings("unused")
 //used in hbase endpoint
-public class CubeVisitService extends CubeVisitProtos.CubeVisitService implements Coprocessor, CoprocessorService {
+public class CubeVisitService extends CubeVisitProtos.CubeVisitService implements RegionCoprocessor {
 
     private static final Logger logger = LoggerFactory.getLogger(CubeVisitService.class);
     //TODO limit memory footprint
@@ -448,7 +448,7 @@ public class CubeVisitService extends CubeVisitProtos.CubeVisitService implement
     }
 
     @Override
-    public Service getService() {
-        return this;
+    public Iterable<Service> getServices() {
+        return Collections.singleton(this);
     }
 }