ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject ambari git commit: AMBARI-19268 ulimit override missing from upgrade catalogs (dsen)
Date Thu, 22 Dec 2016 13:38:18 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 0111c847d -> 633ac3bd5


AMBARI-19268 ulimit override missing from upgrade catalogs (dsen)


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

Branch: refs/heads/trunk
Commit: 633ac3bd532654ea0eec9159d666f9cb43446b5d
Parents: 0111c84
Author: Dmytro Sen <dsen@apache.org>
Authored: Thu Dec 22 15:37:47 2016 +0200
Committer: Dmytro Sen <dsen@apache.org>
Committed: Thu Dec 22 15:37:47 2016 +0200

----------------------------------------------------------------------
 .../server/upgrade/UpgradeCatalog250.java       | 41 ++++++++++++++++++++
 .../server/upgrade/UpgradeCatalog250Test.java   |  5 +++
 2 files changed, 46 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/633ac3bd/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
index 7a385f3..72b2192 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
@@ -57,6 +57,7 @@ public class UpgradeCatalog250 extends AbstractUpgradeCatalog {
   protected static final String GROUPS_TABLE = "groups";
   protected static final String GROUP_TYPE_COL = "group_type";
   private static final String AMS_ENV = "ams-env";
+  private static final String HADOOP_ENV = "hadoop-env";
   private static final String KAFKA_BROKER = "kafka-broker";
   private static final String KAFKA_TIMELINE_METRICS_HOST = "kafka.timeline.metrics.host";
 
@@ -146,6 +147,7 @@ public class UpgradeCatalog250 extends AbstractUpgradeCatalog {
   protected void executeDMLUpdates() throws AmbariException, SQLException {
     addNewConfigurationsFromXml();
     updateAMSConfigs();
+    updateHadoopEnvConfigs();
     updateKafkaConfigs();
     updateHIVEInteractiveConfigs();
     updateTEZInteractiveConfigs();
@@ -299,6 +301,45 @@ public class UpgradeCatalog250 extends AbstractUpgradeCatalog {
     }
   }
 
+
+  protected void updateHadoopEnvConfigs() throws AmbariException {
+    AmbariManagementController ambariManagementController = injector.getInstance(
+        AmbariManagementController.class);
+    Clusters clusters = ambariManagementController.getClusters();
+
+    if (clusters != null) {
+      Map<String, Cluster> clusterMap = clusters.getClusters();
+      Map<String, String> prop = new HashMap<String, String>();
+
+      if (clusterMap != null && !clusterMap.isEmpty()) {
+        for (final Cluster cluster : clusterMap.values()) {
+          /***
+           * Append "ulimit -l" from hadoop-env.sh
+           */
+          String content = null;
+          if (cluster.getDesiredConfigByType(HADOOP_ENV) != null) {
+            content = cluster.getDesiredConfigByType(HADOOP_ENV).getProperties().get("content");
+          }
+
+          if (content != null && !content.contains("ulimit")) {
+            content += "\n" +
+                "{% if is_datanode_max_locked_memory_set %}\n" +
+                "# Fix temporary bug, when ulimit from conf files is not picked up, without
full relogin. \n" +
+                "# Makes sense to fix only when runing DN as root \n" +
+                "if [ \"$command\" == \"datanode\" ] &amp;&amp; [ \"$EUID\" -eq 0
] &amp;&amp; [ -n \"$HADOOP_SECURE_DN_USER\" ]; then\n" +
+                "  ulimit -l {{datanode_max_locked_memory}}\n" +
+                "fi\n" +
+                "{% endif %}";
+
+            prop.put("content", content);
+            updateConfigurationPropertiesForCluster(cluster, "hadoop-env",
+                prop, true, false);
+          }
+        }
+      }
+    }
+  }
+
   /**
    * Creates the servicecomponent_version table
    * @throws SQLException

http://git-wip-us.apache.org/repos/asf/ambari/blob/633ac3bd/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
index 8568a19..f2424a1 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java
@@ -267,6 +267,7 @@ public class UpgradeCatalog250Test {
   @Test
   public void testExecuteDMLUpdates() throws Exception {
     Method updateAmsConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateAMSConfigs");
+    Method updateHadoopEnvConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateHadoopEnvConfigs");
     Method updateKafkaConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateKafkaConfigs");
     Method updateHiveLlapConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateHiveLlapConfigs");
     Method updateHIVEInteractiveConfigs = UpgradeCatalog250.class.getDeclaredMethod("updateHIVEInteractiveConfigs");
@@ -278,6 +279,7 @@ public class UpgradeCatalog250Test {
 
     UpgradeCatalog250 upgradeCatalog250 = createMockBuilder(UpgradeCatalog250.class)
         .addMockedMethod(updateAmsConfigs)
+        .addMockedMethod(updateHadoopEnvConfigs)
         .addMockedMethod(updateKafkaConfigs)
         .addMockedMethod(updateHiveLlapConfigs)
         .addMockedMethod(addNewConfigurationsFromXml)
@@ -291,6 +293,9 @@ public class UpgradeCatalog250Test {
     upgradeCatalog250.updateAMSConfigs();
     expectLastCall().once();
 
+    upgradeCatalog250.updateHadoopEnvConfigs();
+    expectLastCall().once();
+
     upgradeCatalog250.addNewConfigurationsFromXml();
     expectLastCall().once();
 


Mime
View raw message