You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sw...@apache.org on 2016/01/06 23:07:46 UTC

ambari git commit: AMBARI-14572. Add zookeeper tick time setting to AMS for embedded mode. (swagle)

Repository: ambari
Updated Branches:
  refs/heads/trunk 09bfcff68 -> 55651a9b9


AMBARI-14572. Add zookeeper tick time setting to AMS for embedded mode. (swagle)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/55651a9b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/55651a9b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/55651a9b

Branch: refs/heads/trunk
Commit: 55651a9b93e442ecb5cec2eb6226711845c92de2
Parents: 09bfcff
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Wed Jan 6 13:56:14 2016 -0800
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Wed Jan 6 14:07:36 2016 -0800

----------------------------------------------------------------------
 .../server/upgrade/UpgradeCatalog221.java       | 27 +++++++++++++++++---
 .../0.1.0/configuration/ams-hbase-site.xml      |  9 +++++++
 .../server/upgrade/UpgradeCatalog221Test.java   |  8 ++++--
 3 files changed, 39 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/55651a9b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog221.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog221.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog221.java
index f5efde4..5cde24b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog221.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog221.java
@@ -52,11 +52,14 @@ import java.util.UUID;
 public class UpgradeCatalog221 extends AbstractUpgradeCatalog {
 
   private static final String AMS_HBASE_SITE = "ams-hbase-site";
+  private static final String AMS_SITE = "ams-site";
   private static final String AMS_HBASE_SECURITY_SITE = "ams-hbase-security-site";
   private static final String AMS_ENV = "ams-env";
   private static final String AMS_HBASE_ENV = "ams-hbase-env";
+  private static final String AMS_MODE = "timeline.metrics.service.operation.mode";
   private static final String ZK_ZNODE_PARENT = "zookeeper.znode.parent";
   private static final String ZK_CLIENT_PORT = "hbase.zookeeper.property.clientPort";
+  private static final String ZK_TICK_TIME = "hbase.zookeeper.property.tickTime";
   private static final String CLUSTER_ENV = "cluster-env";
   private static final String SECURITY_ENABLED = "security_enabled";
 
@@ -252,13 +255,31 @@ public class UpgradeCatalog221 extends AbstractUpgradeCatalog {
               newProperties.put(ZK_ZNODE_PARENT, znodeParent);
 
             }
-            if (amsHbaseSiteProperties.containsKey(ZK_CLIENT_PORT)) {
+
+            boolean isDistributed = false;
+            Config amsSite = cluster.getDesiredConfigByType(AMS_SITE);
+            if (amsSite != null) {
+              if ("distributed".equals(amsSite.getProperties().get(AMS_MODE))) {
+                isDistributed = true;
+              }
+            }
+
+            // Skip override if custom port found in embedded mode.
+            if (amsHbaseSiteProperties.containsKey(ZK_CLIENT_PORT) &&
+               (isDistributed || amsHbaseSiteProperties.get(ZK_CLIENT_PORT).equals("61181"))) {
               String newValue = "{{zookeeper_clientPort}}";
-              LOG.info("Replacing value of hbase.zookeeper.property.clientPort from " +
-                amsHbaseSiteProperties.get(ZK_CLIENT_PORT) + " to " + newValue);
+              LOG.info("Replacing value of " + ZK_CLIENT_PORT + " from " +
+                amsHbaseSiteProperties.get(ZK_CLIENT_PORT) + " to " +
+                newValue + " in ams-hbase-site");
 
               newProperties.put(ZK_CLIENT_PORT, newValue);
             }
+
+            if (!amsHbaseSiteProperties.containsKey(ZK_TICK_TIME)) {
+              LOG.info("Adding config " + ZK_TICK_TIME + " to ams-hbase-site");
+              newProperties.put(ZK_TICK_TIME, "6000");
+            }
+
             updateConfigurationPropertiesForCluster(cluster, AMS_HBASE_SITE, newProperties, true, true);
           }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/55651a9b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-hbase-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-hbase-site.xml b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-hbase-site.xml
index 12c1be9..6cdffb3 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-hbase-site.xml
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/configuration/ams-hbase-site.xml
@@ -306,6 +306,15 @@
     <description>Enable/Disable HBase replication.</description>
   </property>
   <property>
+    <name>hbase.zookeeper.property.tickTime</name>
+    <value>6000</value>
+    <description>
+      The length of a single tick, which is the basic time unit used by
+      ZooKeeper, as measured in milliseconds. This property setting only
+      affects the ZK server started by AMS in embedded mode. Unit = ms.
+    </description>
+  </property>
+  <property>
     <name>zookeeper.session.timeout</name>
     <value>120000</value>
     <description>ZooKeeper session timeout in milliseconds.</description>

http://git-wip-us.apache.org/repos/asf/ambari/blob/55651a9b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java
index ec8beef..319024b 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java
@@ -72,6 +72,7 @@ import static org.easymock.EasyMock.verify;
 import static org.easymock.EasyMock.anyObject;
 import static org.easymock.EasyMock.anyString;
 import static org.easymock.EasyMock.capture;
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
 public class UpgradeCatalog221Test {
@@ -262,7 +263,7 @@ public class UpgradeCatalog221Test {
       clusterEnvProperties);
 
     //Unsecure with empty value
-    clusterEnvProperties.put("security_enabled","false");
+    clusterEnvProperties.put("security_enabled", "false");
     amsHbaseSecuritySite.put("zookeeper.znode.parent", "");
     newPropertiesAmsHbaseSite.put("zookeeper.znode.parent", "/ams-hbase-unsecure");
     testAmsHbaseSiteUpdates(new HashMap<String, String>(),
@@ -271,7 +272,7 @@ public class UpgradeCatalog221Test {
       clusterEnvProperties);
 
     //Secure with /hbase value
-    clusterEnvProperties.put("security_enabled","true");
+    clusterEnvProperties.put("security_enabled", "true");
     amsHbaseSecuritySite.put("zookeeper.znode.parent", "/hbase");
     newPropertiesAmsHbaseSite.put("zookeeper.znode.parent", "/ams-hbase-secure");
     testAmsHbaseSiteUpdates(new HashMap<String, String>(),
@@ -339,6 +340,9 @@ public class UpgradeCatalog221Test {
     easyMockSupport.verifyAll();
 
     Map<String, String> updatedProperties = propertiesCapture.getValue();
+    // Test zookeeper tick time setting
+    String tickTime = updatedProperties.remove("hbase.zookeeper.property.tickTime");
+    assertEquals("6000", tickTime);
     assertTrue(Maps.difference(newPropertiesAmsHbaseSite, updatedProperties).areEqual());
   }