kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From billy...@apache.org
Subject [04/11] kylin git commit: KYLIN-2459 Make ResourceStore configable
Date Thu, 23 Feb 2017 07:28:18 GMT
KYLIN-2459 Make ResourceStore configable

Signed-off-by: Hongbin Ma <mahongbin@apache.org>


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

Branch: refs/heads/master-hbase0.98
Commit: 82f68035ceee222905e8daf443dd99585fbc4428
Parents: 6f35b62
Author: xiefan46 <958034172@qq.com>
Authored: Wed Feb 22 18:07:49 2017 +0800
Committer: Hongbin Ma <mahongbin@apache.org>
Committed: Wed Feb 22 20:49:04 2017 +0800

----------------------------------------------------------------------
 .../java/org/apache/kylin/common/KylinConfigBase.java   |  5 +++++
 .../apache/kylin/common/persistence/ResourceStore.java  | 12 ++++--------
 2 files changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/82f68035/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 13d967d..1c26c63 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
@@ -957,4 +957,9 @@ abstract public class KylinConfigBase implements Serializable {
         return getOptional("kylin.storage.lock-manager-zk-port", "2181");
     }
 
+    //ResourceStore Impl
+    public String getResourceStoreImpl() {
+        return getOptional("kylin.metadata.default-resource-store-impl", "org.apache.kylin.storage.hbase.HBaseResourceStore");
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/kylin/blob/82f68035/core-common/src/main/java/org/apache/kylin/common/persistence/ResourceStore.java
----------------------------------------------------------------------
diff --git a/core-common/src/main/java/org/apache/kylin/common/persistence/ResourceStore.java
b/core-common/src/main/java/org/apache/kylin/common/persistence/ResourceStore.java
index c441618..77143b0 100644
--- a/core-common/src/main/java/org/apache/kylin/common/persistence/ResourceStore.java
+++ b/core-common/src/main/java/org/apache/kylin/common/persistence/ResourceStore.java
@@ -70,19 +70,15 @@ abstract public class ResourceStore {
 
     private static final ArrayList<Class<? extends ResourceStore>> knownImpl
= new ArrayList<Class<? extends ResourceStore>>();
 
-    private static ArrayList<Class<? extends ResourceStore>> getKnownImpl() {
+    private static ArrayList<Class<? extends ResourceStore>> getKnownImpl(KylinConfig
kylinConfig) {
         if (knownImpl.isEmpty()) {
             knownImpl.add(FileResourceStore.class);
             try {
-                knownImpl.add(ClassUtil.forName("org.apache.kylin.storage.hbase.HBaseResourceStore",
ResourceStore.class));
+                String implName = kylinConfig.getResourceStoreImpl();
+                knownImpl.add(ClassUtil.forName(implName, ResourceStore.class));
             } catch (Throwable e) {
                 logger.warn("Failed to load HBaseResourceStore impl class: " + e.toString());
             }
-            try {
-                knownImpl.add(ClassUtil.forName("org.apache.kylin.storage.hdfs.HDFSResourceStore",
ResourceStore.class));
-            } catch (Throwable e) {
-                logger.warn("Failed to load HDFSResourceStore impl class: " + e.toString());
-            }
         }
         return knownImpl;
     }
@@ -90,7 +86,7 @@ abstract public class ResourceStore {
     private static ResourceStore createResourceStore(KylinConfig kylinConfig) {
         List<Throwable> es = new ArrayList<Throwable>();
         logger.info("Using metadata url " + kylinConfig.getMetadataUrl() + " for resource
store");
-        for (Class<? extends ResourceStore> cls : getKnownImpl()) {
+        for (Class<? extends ResourceStore> cls : getKnownImpl(kylinConfig)) {
             try {
                 return cls.getConstructor(KylinConfig.class).newInstance(kylinConfig);
             } catch (Throwable e) {


Mime
View raw message