Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2219B18781 for ; Wed, 6 Jan 2016 22:11:25 +0000 (UTC) Received: (qmail 3430 invoked by uid 500); 6 Jan 2016 22:11:25 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 3398 invoked by uid 500); 6 Jan 2016 22:11:25 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 3389 invoked by uid 99); 6 Jan 2016 22:11:25 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Jan 2016 22:11:25 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D1B12DFF87; Wed, 6 Jan 2016 22:11:24 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: swagle@apache.org To: commits@ambari.apache.org Message-Id: <3c15b202096f4ca4a4cee28571caf998@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ambari git commit: AMBARI-14572. Add zookeeper tick time setting to AMS for embedded mode. (swagle) Date: Wed, 6 Jan 2016 22:11:24 +0000 (UTC) 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 Authored: Wed Jan 6 14:11:18 2016 -0800 Committer: Siddharth Wagle 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 @@ Enable/Disable HBase replication. + hbase.zookeeper.property.tickTime + 6000 + + 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. + + + zookeeper.session.timeout 120000 ZooKeeper session timeout in milliseconds. 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(), @@ -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(), @@ -339,6 +340,9 @@ public class UpgradeCatalog221Test { ConfigurationRequest configurationRequest = configurationRequestCapture.getValue(); Map 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();