DRILL-956: Fix issue where LocalPStore provider doesn't have correct 
Constructor signature


Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/21d9fb79
Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/21d9fb79
Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/21d9fb79

Branch: refs/heads/master
Commit: 21d9fb79da6810170dea668f1884cc73e4676410
Parents: 53e218e
Author: Aditya Kishore <[email protected]>
Authored: Wed Jun 11 17:09:26 2014 -0700
Committer: Jacques Nadeau <[email protected]>
Committed: Wed Jun 11 21:30:30 2014 -0700

----------------------------------------------------------------------
 .../exec/store/hbase/config/HBasePStoreProvider.java      |  8 ++++++++
 .../org/apache/drill/hbase/TestHBaseTableProvider.java    | 10 ++--------
 distribution/src/resources/drill-override-example.conf    |  3 ++-
 .../org/apache/drill/exec/store/sys/PStoreRegistry.java   |  8 ++++----
 .../drill/exec/store/sys/local/LocalPStoreProvider.java   | 10 +++++++---
 5 files changed, 23 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/21d9fb79/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/config/HBasePStoreProvider.java
----------------------------------------------------------------------
diff --git 
a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/config/HBasePStoreProvider.java
 
b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/config/HBasePStoreProvider.java
index c16d3df..48e6c42 100644
--- 
a/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/config/HBasePStoreProvider.java
+++ 
b/contrib/storage-hbase/src/main/java/org/apache/drill/exec/store/hbase/config/HBasePStoreProvider.java
@@ -37,6 +37,8 @@ import org.apache.hadoop.hbase.client.HConnectionManager;
 import org.apache.hadoop.hbase.client.HTableInterface;
 import org.apache.hadoop.hbase.util.Bytes;
 
+import com.google.common.annotations.VisibleForTesting;
+
 public class HBasePStoreProvider implements PStoreProvider {
   static final org.slf4j.Logger logger = 
org.slf4j.LoggerFactory.getLogger(HBasePStoreProvider.class);
 
@@ -65,6 +67,12 @@ public class HBasePStoreProvider implements PStoreProvider {
     this.storeTableName = 
registry.getConfig().getString(DrillHBaseConstants.SYS_STORE_PROVIDER_HBASE_TABLE);
   }
 
+  @VisibleForTesting
+  public HBasePStoreProvider(Configuration conf, String storeTableName) {
+    this.hbaseConf = conf;
+    this.storeTableName = storeTableName;
+  }
+
   @Override
   public <V> PStore<V> getPStore(PStoreConfig<V> store) throws IOException {
     return new HBasePStore<V>(store, this.table);

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/21d9fb79/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseTableProvider.java
----------------------------------------------------------------------
diff --git 
a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseTableProvider.java
 
b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseTableProvider.java
index 8fb7b39..c94e61f 100644
--- 
a/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseTableProvider.java
+++ 
b/contrib/storage-hbase/src/test/java/org/apache/drill/hbase/TestHBaseTableProvider.java
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.util.Map;
 import java.util.Map.Entry;
 
+import org.apache.drill.common.config.DrillConfig;
 import org.apache.drill.exec.store.hbase.DrillHBaseConstants;
 import org.apache.drill.exec.store.hbase.config.HBasePStoreProvider;
 import org.apache.drill.exec.store.sys.PStore;
@@ -43,14 +44,7 @@ public class TestHBaseTableProvider extends BaseHBaseTest {
 
   @BeforeClass // mask HBase cluster start function
   public static void setUpBeforeTestHBaseTableProvider() throws Exception {
-    Map<String, String> hbaseProps = Maps.newHashMap();
-    hbaseProps.put(HConstants.ZOOKEEPER_QUORUM, 
storagePluginConfig.getZookeeperQuorum());
-    hbaseProps.put(DrillHBaseConstants.HBASE_ZOOKEEPER_PORT, 
storagePluginConfig.getZookeeperport());
-    Config newConfig = bit.getContext().getConfig()
-        .withValue(DrillHBaseConstants.SYS_STORE_PROVIDER_HBASE_CONFIG, 
ConfigValueFactory.fromMap(hbaseProps))
-        .withValue(DrillHBaseConstants.SYS_STORE_PROVIDER_HBASE_TABLE, 
ConfigValueFactory.fromAnyRef("drill_store"));
-    PStoreRegistry registry = new PStoreRegistry(bit.getCoordinator(), 
newConfig);
-    provider = new HBasePStoreProvider(registry);
+    provider = new HBasePStoreProvider(storagePluginConfig.getHBaseConf(), 
"drill_store");
     provider.start();
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/21d9fb79/distribution/src/resources/drill-override-example.conf
----------------------------------------------------------------------
diff --git a/distribution/src/resources/drill-override-example.conf 
b/distribution/src/resources/drill-override-example.conf
index 9d87f76..64a7bc5 100644
--- a/distribution/src/resources/drill-override-example.conf
+++ b/distribution/src/resources/drill-override-example.conf
@@ -95,7 +95,8 @@ drill.exec: {
     executor.threads: 4
   },
   sys.store.provider: {
-    class: "org.apache.drill.exec.store.sys.local.LocalPStoreProvider",
+    class: "org.apache.drill.exec.store.sys.zk.ZkPStoreProvider",
+    # The following section is only required by LocalPStoreProvider
     local: {
       path: "/tmp/drill",
       write: true

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/21d9fb79/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/PStoreRegistry.java
----------------------------------------------------------------------
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/PStoreRegistry.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/PStoreRegistry.java
index 7ba7ada..e69c12d 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/PStoreRegistry.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/PStoreRegistry.java
@@ -20,20 +20,20 @@ package org.apache.drill.exec.store.sys;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 
+import org.apache.drill.common.config.DrillConfig;
 import org.apache.drill.common.exceptions.ExecutionSetupException;
 import org.apache.drill.exec.ExecConstants;
 import org.apache.drill.exec.coord.ClusterCoordinator;
 
-import com.typesafe.config.Config;
 import com.typesafe.config.ConfigException;
 
 public class PStoreRegistry {
   static final org.slf4j.Logger logger = 
org.slf4j.LoggerFactory.getLogger(PStoreRegistry.class);
 
-  private Config config;
+  private DrillConfig config;
   private ClusterCoordinator coord;
 
-  public PStoreRegistry(ClusterCoordinator coord, Config config) {
+  public PStoreRegistry(ClusterCoordinator coord, DrillConfig config) {
     this.coord = coord;
     this.config = config;
   }
@@ -42,7 +42,7 @@ public class PStoreRegistry {
     return this.coord;
   }
 
-  public Config getConfig() {
+  public DrillConfig getConfig() {
     return this.config;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/21d9fb79/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/local/LocalPStoreProvider.java
----------------------------------------------------------------------
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/local/LocalPStoreProvider.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/local/LocalPStoreProvider.java
index 32a981a..16fd875 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/local/LocalPStoreProvider.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/local/LocalPStoreProvider.java
@@ -20,12 +20,12 @@ package org.apache.drill.exec.store.sys.local;
 import java.io.File;
 import java.io.IOException;
 
+import org.apache.drill.common.config.DrillConfig;
 import org.apache.drill.exec.ExecConstants;
 import org.apache.drill.exec.store.sys.PStore;
 import org.apache.drill.exec.store.sys.PStoreConfig;
 import org.apache.drill.exec.store.sys.PStoreProvider;
-
-import com.typesafe.config.Config;
+import org.apache.drill.exec.store.sys.PStoreRegistry;
 
 /**
  * A really simple provider that stores data in the local file system, one 
value per file.
@@ -36,11 +36,15 @@ public class LocalPStoreProvider implements PStoreProvider{
   private File path;
   private final boolean enableWrite;
 
-  public LocalPStoreProvider(Config config) {
+  public LocalPStoreProvider(DrillConfig config) {
     path = new 
File(config.getString(ExecConstants.SYS_STORE_PROVIDER_LOCAL_PATH));
     enableWrite = 
config.getBoolean(ExecConstants.SYS_STORE_PROVIDER_LOCAL_ENABLE_WRITE);
   }
 
+  public LocalPStoreProvider(PStoreRegistry registry) {
+    this(registry.getConfig());
+  }
+
   @Override
   public void close() {
   }

Reply via email to