ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From avija...@apache.org
Subject ambari git commit: AMBARI-15452 : Change timeouts for Hbase and Phoenix (avijayan)
Date Thu, 17 Mar 2016 19:52:10 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 33eeec800 -> 201961a4a


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

Branch: refs/heads/trunk
Commit: 201961a4a4f86b50a39bbb0cec0e33d05da2c842
Parents: 33eeec8
Author: Aravindan Vijayan <avijayan@hortonworks.com>
Authored: Thu Mar 17 12:51:56 2016 -0700
Committer: Aravindan Vijayan <avijayan@hortonworks.com>
Committed: Thu Mar 17 12:51:56 2016 -0700

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


http://git-wip-us.apache.org/repos/asf/ambari/blob/201961a4/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..84bb9f3 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,31 @@ 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/201961a4/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 2b69dc5..c941157 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
@@ -233,20 +233,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/201961a4/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 f5fbd55..acbf055 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
@@ -353,6 +353,65 @@ 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[] { })
+      .addMockedMethod("createConfig")
+      .withConstructor(createNiceMock(ActionManager.class), clusters, injector)
+      .createNiceMock();
+
+    Injector injector2 = easyMockSupport.createNiceMock(Injector.class);
+    Capture<Map> propertiesCapture = EasyMock.newCapture();
+
+    expect(injector2.getInstance(AmbariManagementController.class)).andReturn(controller).anyTimes();
+    expect(controller.getClusters()).andReturn(clusters).anyTimes();
+    expect(controller.createConfig(anyObject(Cluster.class), anyString(), capture(propertiesCapture),
anyString(),
+      anyObject(Map.class))).andReturn(createNiceMock(Config.class)).once();
+
+    replay(controller, injector2);
+    new UpgradeCatalog222(injector2).updateAMSConfigs();
+    easyMockSupport.verifyAll();
+
+    Map<String, String> updatedProperties = propertiesCapture.getValue();
+    assertTrue(Maps.difference(newPropertiesAmsHbaseSite, updatedProperties).areEqual());
+  }
+
+  @Test
   public void testHDFSWidgetUpdateWithOnlyZkService() throws Exception {
     final Clusters clusters = createNiceMock(Clusters.class);
     final Cluster cluster = createNiceMock(Cluster.class);


Mime
View raw message