You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by ja...@apache.org on 2017/04/07 09:55:18 UTC

[15/49] incubator-carbondata git commit: if no locktype is configured and store type is HDFS set HDFS lock as default

if no locktype is configured and store type is HDFS set HDFS lock as default


Project: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/commit/41bfd4a5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/tree/41bfd4a5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/diff/41bfd4a5

Branch: refs/heads/12-dev
Commit: 41bfd4a571c1e63c82c927ee3d487b532a982600
Parents: bca8b88
Author: Manohar <ma...@gmail.com>
Authored: Wed Apr 5 20:03:30 2017 +0530
Committer: ravipesala <ra...@gmail.com>
Committed: Thu Apr 6 14:09:57 2017 +0530

----------------------------------------------------------------------
 .../apache/spark/sql/hive/CarbonMetastore.scala | 28 ++++++++++----------
 .../apache/spark/sql/hive/CarbonMetastore.scala | 28 ++++++++++----------
 2 files changed, 28 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/41bfd4a5/integration/spark/src/main/scala/org/apache/spark/sql/hive/CarbonMetastore.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/main/scala/org/apache/spark/sql/hive/CarbonMetastore.scala b/integration/spark/src/main/scala/org/apache/spark/sql/hive/CarbonMetastore.scala
index 9fcd185..d5cc540 100644
--- a/integration/spark/src/main/scala/org/apache/spark/sql/hive/CarbonMetastore.scala
+++ b/integration/spark/src/main/scala/org/apache/spark/sql/hive/CarbonMetastore.scala
@@ -161,24 +161,24 @@ class CarbonMetastore(hiveContext: HiveContext, val storePath: String,
     val statistic = new QueryStatistic()
     // creating zookeeper instance once.
     // if zookeeper is configured as carbon lock type.
-    val zookeeperUrl: String = hiveContext.getConf(CarbonCommonConstants.ZOOKEEPER_URL, null)
-    if (zookeeperUrl != null) {
-      CarbonProperties.getInstance.addProperty(CarbonCommonConstants.ZOOKEEPER_URL, zookeeperUrl)
-      ZookeeperInit.getInstance(zookeeperUrl)
-      LOGGER.info("Zookeeper url is configured. Taking the zookeeper as lock type.")
-      var configuredLockType = CarbonProperties.getInstance
-        .getProperty(CarbonCommonConstants.LOCK_TYPE)
-      if (null == configuredLockType) {
-        configuredLockType = CarbonCommonConstants.CARBON_LOCK_TYPE_ZOOKEEPER
-        CarbonProperties.getInstance
-          .addProperty(CarbonCommonConstants.LOCK_TYPE,
-            configuredLockType)
-      }
+    val zookeeperurl = hiveContext.getConf(CarbonCommonConstants.ZOOKEEPER_URL, null)
+    if (null != zookeeperurl) {
+      CarbonProperties.getInstance
+        .addProperty(CarbonCommonConstants.ZOOKEEPER_URL, zookeeperurl)
     }
-
     if (metadataPath == null) {
       return null
     }
+    // if no locktype is configured and store type is HDFS set HDFS lock as default
+    if (null == CarbonProperties.getInstance
+      .getProperty(CarbonCommonConstants.LOCK_TYPE) &&
+        FileType.HDFS == FileFactory.getFileType(metadataPath)) {
+      CarbonProperties.getInstance
+        .addProperty(CarbonCommonConstants.LOCK_TYPE,
+          CarbonCommonConstants.CARBON_LOCK_TYPE_HDFS
+        )
+      LOGGER.info("Default lock type HDFSLOCK is configured")
+    }
     val fileType = FileFactory.getFileType(metadataPath)
     val metaDataBuffer = new ArrayBuffer[TableMeta]
     fillMetaData(metadataPath, fileType, metaDataBuffer)

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/41bfd4a5/integration/spark2/src/main/scala/org/apache/spark/sql/hive/CarbonMetastore.scala
----------------------------------------------------------------------
diff --git a/integration/spark2/src/main/scala/org/apache/spark/sql/hive/CarbonMetastore.scala b/integration/spark2/src/main/scala/org/apache/spark/sql/hive/CarbonMetastore.scala
index 39d8798..f7ea344 100644
--- a/integration/spark2/src/main/scala/org/apache/spark/sql/hive/CarbonMetastore.scala
+++ b/integration/spark2/src/main/scala/org/apache/spark/sql/hive/CarbonMetastore.scala
@@ -200,24 +200,24 @@ class CarbonMetastore(conf: RuntimeConfig, val storePath: String) {
     val statistic = new QueryStatistic()
     // creating zookeeper instance once.
     // if zookeeper is configured as carbon lock type.
-    val zookeeperUrl: String = conf.get(CarbonCommonConstants.ZOOKEEPER_URL, null)
-    if (zookeeperUrl != null) {
-      CarbonProperties.getInstance.addProperty(CarbonCommonConstants.ZOOKEEPER_URL, zookeeperUrl)
-      ZookeeperInit.getInstance(zookeeperUrl)
-      LOGGER.info("Zookeeper url is configured. Taking the zookeeper as lock type.")
-      var configuredLockType = CarbonProperties.getInstance
-        .getProperty(CarbonCommonConstants.LOCK_TYPE)
-      if (null == configuredLockType) {
-        configuredLockType = CarbonCommonConstants.CARBON_LOCK_TYPE_ZOOKEEPER
-        CarbonProperties.getInstance
-          .addProperty(CarbonCommonConstants.LOCK_TYPE,
-            configuredLockType)
-      }
+    val zookeeperurl = conf.get(CarbonCommonConstants.ZOOKEEPER_URL, null)
+    if (null != zookeeperurl) {
+      CarbonProperties.getInstance
+        .addProperty(CarbonCommonConstants.ZOOKEEPER_URL, zookeeperurl)
     }
-
     if (metadataPath == null) {
       return null
     }
+    // if no locktype is configured and store type is HDFS set HDFS lock as default
+    if (null == CarbonProperties.getInstance
+      .getProperty(CarbonCommonConstants.LOCK_TYPE) &&
+        FileType.HDFS == FileFactory.getFileType(metadataPath)) {
+      CarbonProperties.getInstance
+        .addProperty(CarbonCommonConstants.LOCK_TYPE,
+          CarbonCommonConstants.CARBON_LOCK_TYPE_HDFS
+        )
+      LOGGER.info("Default lock type HDFSLOCK is configured")
+    }
     val fileType = FileFactory.getFileType(metadataPath)
     val metaDataBuffer = new ArrayBuffer[TableMeta]
     fillMetaData(metadataPath, fileType, metaDataBuffer)