ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From swa...@apache.org
Subject ambari git commit: AMBARI-14572. Add zookeeper tick time setting to AMS for embedded mode. (swagle)
Date Wed, 06 Jan 2016 22:11:24 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 7caf6b01f -> abdfbadd2


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/abdfbadd
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/abdfbadd
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/abdfbadd

Branch: refs/heads/branch-2.2
Commit: abdfbadd2122f9f64ca039b5e3195044d19b5efb
Parents: 7caf6b0
Author: Siddharth Wagle <swagle@hortonworks.com>
Authored: Wed Jan 6 14:11:18 2016 -0800
Committer: Siddharth Wagle <swagle@hortonworks.com>
Committed: Wed Jan 6 14:11:18 2016 -0800

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


http://git-wip-us.apache.org/repos/asf/ambari/blob/abdfbadd/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/abdfbadd/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 9bae6eb..5f0ac12 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
@@ -303,6 +303,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/abdfbadd/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 cf37ab3..bd716b8 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
@@ -71,6 +71,7 @@ import static org.easymock.EasyMock.expectLastCall;
 import static org.easymock.EasyMock.replay;
 import static org.easymock.EasyMock.reset;
 import static org.easymock.EasyMock.verify;
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
 public class UpgradeCatalog221Test {
@@ -261,7 +262,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>(),
@@ -270,7 +271,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 {
 
     ConfigurationRequest configurationRequest = configurationRequestCapture.getValue();
     Map<String, String> updatedProperties = configurationRequest.getProperties();
+    // Test zookeeper tick time setting
+    String tickTime = updatedProperties.remove("hbase.zookeeper.property.tickTime");
+    assertEquals("6000", tickTime);
     assertTrue(Maps.difference(newPropertiesAmsHbaseSite, updatedProperties).areEqual());
   }
 
@@ -377,7 +381,7 @@ public class UpgradeCatalog221Test {
 
     AmbariManagementControllerImpl controller = createMockBuilder(AmbariManagementControllerImpl.class)
       .addMockedMethod("createConfiguration")
-      .addMockedMethod("getClusters", new Class[] { })
+      .addMockedMethod("getClusters", new Class[]{})
       .withConstructor(createNiceMock(ActionManager.class), clusters, injector)
       .createNiceMock();
 


Mime
View raw message