ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vbrodets...@apache.org
Subject git commit: AMBARI-7867. mapreduce2-log4j is empty after upgrade to 1.7.0.(vbrodetskyi)
Date Mon, 20 Oct 2014 16:26:48 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 9bd3e90d9 -> 6930dd928


AMBARI-7867. mapreduce2-log4j is empty after upgrade to 1.7.0.(vbrodetskyi)


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

Branch: refs/heads/trunk
Commit: 6930dd92892c1b261a3bb3fbc7cb7575d91e9e05
Parents: 9bd3e90
Author: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Authored: Mon Oct 20 17:24:28 2014 +0300
Committer: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Committed: Mon Oct 20 17:24:28 2014 +0300

----------------------------------------------------------------------
 .../server/configuration/Configuration.java     |  1 +
 .../server/upgrade/UpgradeCatalog170.java       | 22 ++++++++++++++++++++
 .../server/upgrade/UpgradeCatalog170Test.java   |  2 +-
 3 files changed, 24 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6930dd92/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
index 1a483ca..b3573f6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
@@ -200,6 +200,7 @@ public class Configuration {
   public static final String CLIENT_API_SSL_KEY_NAME_DEFAULT = "https.key";
   public static final String CLIENT_API_SSL_CRT_NAME_DEFAULT = "https.crt";
   public static final String GLOBAL_CONFIG_TAG = "global";
+  public static final String MAPREDUCE2_LOG4J_CONFIG_TAG = "mapreduce2-log4j";
   public static final String RCA_ENABLED_PROPERTY = "rca_enabled";
   public static final String HIVE_CONFIG_TAG = "hive-site";
   public static final String HIVE_METASTORE_PASSWORD_PROPERTY =

http://git-wip-us.apache.org/repos/asf/ambari/blob/6930dd92/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java
index a387cb9..66909d7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java
@@ -649,6 +649,28 @@ public class UpgradeCatalog170 extends AbstractUpgradeCatalog {
     moveConfigGroupsGlobalToEnv();
     addMissingConfigs();
     updateClusterProvisionState();
+    removeMapred2Log4jConfig();
+  }
+
+  private void removeMapred2Log4jConfig() {
+    ConfigHelper configHelper = injector.getInstance(ConfigHelper.class);
+
+    AmbariManagementController ambariManagementController = injector.getInstance(
+            AmbariManagementController.class);
+    Clusters clusters = ambariManagementController.getClusters();
+    if (clusters == null) {
+      return;
+    }
+    Map<String, Cluster> clusterMap = clusters.getClusters();
+
+    if (clusterMap != null && !clusterMap.isEmpty()) {
+      for (final Cluster cluster : clusterMap.values()) {
+        Config config = cluster.getDesiredConfigByType(Configuration.MAPREDUCE2_LOG4J_CONFIG_TAG);
+        if (config != null) {
+          configHelper.removeConfigsByType(cluster, Configuration.MAPREDUCE2_LOG4J_CONFIG_TAG);
+        }
+      }
+    }
   }
 
   public void updateClusterProvisionState() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/6930dd92/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java
b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java
index 3271864..a02a962 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java
@@ -502,7 +502,7 @@ public class UpgradeCatalog170Test {
     expect(amc.getClusters()).andReturn(clusters).anyTimes();
     expect(clusters.getClusters()).andReturn(clustersMap).anyTimes();
     expect(clusters.getClusterById(1L)).andReturn(clustersMap.values().iterator().next()).anyTimes();
-    expect(clusters.getClusters()).andReturn(clustersMap).once();
+    expect(clusters.getClusters()).andReturn(clustersMap).times(2);
     expect(cluster.getDesiredConfigByType("global")).andReturn(config).anyTimes();
     expect(cluster.getDesiredConfigByType("oozie-log4j")).andReturn(config).anyTimes();
     expect(cluster.getClusterId()).andReturn(1L);


Mime
View raw message