carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravipes...@apache.org
Subject [11/47] incubator-carbondata git commit: [CARBONDATA-96] Make zookeeper lock as default if zookeeper url is configured. make zookeeper as default if zookeeper url is configured. (#712)
Date Mon, 01 Aug 2016 10:05:09 GMT
[CARBONDATA-96] Make zookeeper lock as default if zookeeper url is configured. make zookeeper
as default if zookeeper url is configured. (#712)

Make the lock type as zookeeper if zookeeper URL is present in the spark conf.
if spark.deploy.zookeeper.url property is set in spark-default.conf then need to take the
zookeeper locking.

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

Branch: refs/heads/master
Commit: c3197a8645b5b2d06b298b07888693cfa1c2e793
Parents: 30e4f25
Author: ravikiran23 <ravikiran.sn042@gmail.com>
Authored: Sat Jul 23 12:55:12 2016 +0530
Committer: Venkata Ramana G <g.ramana.v1@gmail.com>
Committed: Sat Jul 23 12:55:12 2016 +0530

----------------------------------------------------------------------
 .../org/carbondata/core/locks/CarbonLockFactory.java     |  5 ++---
 .../apache/spark/sql/hive/CarbonMetastoreCatalog.scala   | 11 +++++++----
 2 files changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/c3197a86/core/src/main/java/org/carbondata/core/locks/CarbonLockFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/core/locks/CarbonLockFactory.java b/core/src/main/java/org/carbondata/core/locks/CarbonLockFactory.java
index 8616c68..b650cd4 100644
--- a/core/src/main/java/org/carbondata/core/locks/CarbonLockFactory.java
+++ b/core/src/main/java/org/carbondata/core/locks/CarbonLockFactory.java
@@ -34,7 +34,7 @@ public class CarbonLockFactory {
   private static String lockTypeConfigured;
 
   static {
-    CarbonLockFactory.updateZooKeeperLockingStatus();
+    CarbonLockFactory.getLockTypeConfigured();
   }
 
   /**
@@ -86,10 +86,9 @@ public class CarbonLockFactory {
   /**
    * This method will set the zookeeper status whether zookeeper to be used for locking or
not.
    */
-  private static void updateZooKeeperLockingStatus() {
+  private static void getLockTypeConfigured() {
     lockTypeConfigured = CarbonProperties.getInstance()
         .getProperty(CarbonCommonConstants.LOCK_TYPE, CarbonCommonConstants.LOCK_TYPE_DEFAULT);
-
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/c3197a86/integration/spark/src/main/scala/org/apache/spark/sql/hive/CarbonMetastoreCatalog.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/main/scala/org/apache/spark/sql/hive/CarbonMetastoreCatalog.scala
b/integration/spark/src/main/scala/org/apache/spark/sql/hive/CarbonMetastoreCatalog.scala
index f952aa3..5966240 100644
--- a/integration/spark/src/main/scala/org/apache/spark/sql/hive/CarbonMetastoreCatalog.scala
+++ b/integration/spark/src/main/scala/org/apache/spark/sql/hive/CarbonMetastoreCatalog.scala
@@ -207,11 +207,14 @@ class CarbonMetastoreCatalog(hive: HiveContext, val storePath: String,
client: C
 
     // creating zookeeper instance once.
     // if zookeeper is configured as carbon lock type.
-    if (CarbonProperties.getInstance()
-      .getProperty(CarbonCommonConstants.LOCK_TYPE, CarbonCommonConstants.LOCK_TYPE_DEFAULT)
-      .equalsIgnoreCase(CarbonCommonConstants.CARBON_LOCK_TYPE_ZOOKEEPER)) {
-      val zookeeperUrl = hive.getConf("spark.deploy.zookeeper.url", "127.0.0.1:2181")
+    val zookeeperUrl: String = hive.getConf("spark.deploy.zookeeper.url", null)
+    if (zookeeperUrl != null) {
       ZookeeperInit.getInstance(zookeeperUrl)
+      LOGGER.info("Zookeeper url is configured. Taking the zookeeper as lock type.")
+      CarbonProperties.getInstance
+        .addProperty(CarbonCommonConstants.LOCK_TYPE,
+          CarbonCommonConstants.CARBON_LOCK_TYPE_ZOOKEEPER
+        )
     }
 
     if (metadataPath == null) {


Mime
View raw message