You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by av...@apache.org on 2016/03/17 20:40:40 UTC

ambari git commit: AMBARI-15452 : Change timeouts for Hbase and Phoenix (avijayan)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 0244d233a -> 48b23a52a


AMBARI-15452 : Change timeouts for Hbase and Phoenix (avijayan)


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

Branch: refs/heads/branch-2.2
Commit: 48b23a52a444a86ae61f1afb64f2f649516d6e62
Parents: 0244d23
Author: Aravindan Vijayan <av...@hortonworks.com>
Authored: Thu Mar 17 12:40:25 2016 -0700
Committer: Aravindan Vijayan <av...@hortonworks.com>
Committed: Thu Mar 17 12:40:33 2016 -0700

----------------------------------------------------------------------
 .../server/upgrade/UpgradeCatalog222.java       | 29 ++++++++++
 .../0.1.0/configuration/ams-hbase-site.xml      | 24 +++++++-
 .../server/upgrade/UpgradeCatalog222Test.java   | 60 ++++++++++++++++++++
 3 files changed, 110 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/48b23a52/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog222.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog222.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog222.java
index 8267d5d..e10585e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog222.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog222.java
@@ -66,6 +66,7 @@ public class UpgradeCatalog222 extends AbstractUpgradeCatalog {
    */
   private static final Logger LOG = LoggerFactory.getLogger(UpgradeCatalog222.class);
   private static final String AMS_SITE = "ams-site";
+  private static final String AMS_HBASE_SITE = "ams-hbase-site";
   private static final String HIVE_SITE_CONFIG = "hive-site";
   private static final String ATLAS_APPLICATION_PROPERTIES_CONFIG = "application-properties";
   private static final String ATLAS_HOOK_HIVE_MINTHREADS_PROPERTY = "atlas.hook.hive.minThreads";
@@ -85,6 +86,10 @@ public class UpgradeCatalog222 extends AbstractUpgradeCatalog {
   public static final String PRECISION_TABLE_TTL = "timeline.metrics.host.aggregator.ttl";
   public static final String CLUSTER_SECOND_TABLE_TTL = "timeline.metrics.cluster.aggregator.second.ttl";
   public static final String CLUSTER_MINUTE_TABLE_TTL = "timeline.metrics.cluster.aggregator.minute.ttl";
+  public static final String HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD = "hbase.client.scanner.timeout.period";
+  public static final String HBASE_RPC_TIMEOUT = "hbase.rpc.timeout";
+  public static final String PHOENIX_QUERY_TIMEOUT = "phoenix.query.timeoutMs";
+  public static final String PHOENIX_QUERY_KEEPALIVE = "phoenix.query.keepAliveMs";
 
   private static final String[] HDFS_WIDGETS_TO_UPDATE = new String[] {
     "NameNode RPC", "NN Connection Load" };
@@ -313,6 +318,30 @@ public class UpgradeCatalog222 extends AbstractUpgradeCatalog {
             updateConfigurationPropertiesForCluster(cluster, AMS_SITE, newProperties, true, true);
           }
 
+          Config amsHbaseSite = cluster.getDesiredConfigByType(AMS_HBASE_SITE);
+          if (amsHbaseSite != null) {
+            Map<String, String> amsHbaseSiteProperties = amsHbaseSite.getProperties();
+            Map<String, String> newProperties = new HashMap<>();
+
+            if (!amsHbaseSiteProperties.containsKey(HBASE_RPC_TIMEOUT)) {
+              newProperties.put(HBASE_RPC_TIMEOUT, String.valueOf(300000));
+            }
+
+            if (!amsHbaseSiteProperties.containsKey(PHOENIX_QUERY_KEEPALIVE)) {
+              newProperties.put(PHOENIX_QUERY_KEEPALIVE, String.valueOf(300000));
+            }
+
+            if (!amsHbaseSiteProperties.containsKey(HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD) ||
+              amsHbaseSiteProperties.get(HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD).equals("900000")) {
+              amsHbaseSiteProperties.put(HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD, String.valueOf(300000));
+            }
+
+            if (!amsHbaseSiteProperties.containsKey(PHOENIX_QUERY_TIMEOUT) ||
+              amsHbaseSiteProperties.get(PHOENIX_QUERY_TIMEOUT).equals("1200000")) {
+              amsHbaseSiteProperties.put(PHOENIX_QUERY_TIMEOUT, String.valueOf(300000));
+            }
+            updateConfigurationPropertiesForCluster(cluster, AMS_HBASE_SITE, newProperties, true, true);
+          }
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/48b23a52/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 acd14aa..815b126 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
@@ -230,20 +230,38 @@
   </property>
   <property>
     <name>phoenix.query.timeoutMs</name>
-    <value>1200000</value>
+    <value>300000</value>
     <description>
       Number of milliseconds after which a query will timeout on the client.
-      Default is 10 min.
+      Default is 5 min.
+    </description>
+  </property>
+  <property>
+    <name>phoenix.query.keepAliveMs</name>
+    <value>300000</value>
+    <description>
+      Number of milliseconds after which a query will keep the connection to HBase alive.
+      Default is 5 min.
     </description>
   </property>
   <property>
     <name>hbase.client.scanner.timeout.period</name>
-    <value>900000</value>
+    <value>300000</value>
     <description>
       Client scanner lease period in milliseconds.
     </description>
   </property>
   <property>
+    <name>hbase.rpc.timeout</name>
+    <value>30000</value>
+    <description>
+      This is for the RPC layer to define how long HBase client applications
+      take for a remote call to time out. It uses pings to check connections
+      but will eventually throw a TimeoutException.
+    </description>
+    <display-name>HBase RPC Timeout</display-name>
+  </property>
+  <property>
     <name>hbase.regionserver.thread.compaction.large</name>
     <value>2</value>
     <description>

http://git-wip-us.apache.org/repos/asf/ambari/blob/48b23a52/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java
index 82d5464..859513b 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog222Test.java
@@ -354,6 +354,66 @@ public class UpgradeCatalog222Test {
   }
 
   @Test
+  public void testAmsHbaseSiteUpdateConfigs() throws Exception{
+
+    Map<String, String> oldPropertiesAmsHbaseSite = new HashMap<String, String>() {
+      {
+        put("hbase.client.scanner.timeout.period", String.valueOf(900000));
+        put("phoenix.query.timeoutMs", String.valueOf(1200000));
+      }
+    };
+    Map<String, String> newPropertiesAmsHbaseSite = new HashMap<String, String>() {
+      {
+        put("hbase.client.scanner.timeout.period", String.valueOf(300000));
+        put("hbase.rpc.timeout", String.valueOf(300000));
+        put("phoenix.query.timeoutMs", String.valueOf(300000));
+        put("phoenix.query.keepAliveMs", String.valueOf(300000));
+      }
+    };
+    EasyMockSupport easyMockSupport = new EasyMockSupport();
+
+    Clusters clusters = easyMockSupport.createNiceMock(Clusters.class);
+    final Cluster cluster = easyMockSupport.createNiceMock(Cluster.class);
+    Config mockAmsHbaseSite = easyMockSupport.createNiceMock(Config.class);
+
+    expect(clusters.getClusters()).andReturn(new HashMap<String, Cluster>() {{
+      put("normal", cluster);
+    }}).once();
+    expect(cluster.getDesiredConfigByType("ams-hbase-site")).andReturn(mockAmsHbaseSite).atLeastOnce();
+    expect(mockAmsHbaseSite.getProperties()).andReturn(oldPropertiesAmsHbaseSite).anyTimes();
+
+    Injector injector = easyMockSupport.createNiceMock(Injector.class);
+    expect(injector.getInstance(Gson.class)).andReturn(null).anyTimes();
+    expect(injector.getInstance(MaintenanceStateHelper.class)).andReturn(null).anyTimes();
+    expect(injector.getInstance(KerberosHelper.class)).andReturn(createNiceMock(KerberosHelper.class)).anyTimes();
+
+    replay(injector, clusters, mockAmsHbaseSite, cluster);
+
+    AmbariManagementControllerImpl controller = createMockBuilder(AmbariManagementControllerImpl.class)
+      .addMockedMethod("createConfiguration")
+      .addMockedMethod("getClusters", new Class[] { })
+      .withConstructor(createNiceMock(ActionManager.class), clusters, injector)
+      .createNiceMock();
+
+    Injector injector2 = easyMockSupport.createNiceMock(Injector.class);
+    Capture<ConfigurationRequest> configurationRequestCapture = EasyMock.newCapture();
+    ConfigurationResponse configurationResponseMock = easyMockSupport.createMock(ConfigurationResponse.class);
+
+    expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
+    expect(controller.getClusters()).andReturn(clusters).anyTimes();
+    expect(controller.createConfiguration(capture(configurationRequestCapture))).andReturn(configurationResponseMock)
+      .anyTimes();
+
+    replay(controller, injector2, configurationResponseMock);
+    new UpgradeCatalog222(injector2).updateAMSConfigs();
+    easyMockSupport.verifyAll();
+
+    ConfigurationRequest configurationRequest = configurationRequestCapture.getValue();
+    Map<String, String> updatedProperties = configurationRequest.getProperties();
+    assertTrue(Maps.difference(newPropertiesAmsHbaseSite, updatedProperties).areEqual());
+  }
+
+  @Test
   public void testHDFSWidgetUpdateWithOnlyZkService() throws Exception {
     final Clusters clusters = createNiceMock(Clusters.class);
     final Cluster cluster = createNiceMock(Cluster.class);