You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2016/03/02 19:06:44 UTC

[2/2] ambari git commit: AMBARI-15160. YARN restart icon appeared after 5 minutes after reconfig (aonishuk)

AMBARI-15160. YARN restart icon appeared after 5 minutes after reconfig (aonishuk)


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

Branch: refs/heads/branch-2.2
Commit: 0b80ca7d2c03e333fef3917c541ae67e9eaad13c
Parents: 8ccbf8f
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Wed Mar 2 20:06:39 2016 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Wed Mar 2 20:06:39 2016 +0200

----------------------------------------------------------------------
 .../org/apache/ambari/server/state/Cluster.java  |  7 +++++++
 .../apache/ambari/server/state/ConfigHelper.java |  4 ++--
 .../ambari/server/state/cluster/ClusterImpl.java | 19 ++++++++++++-------
 3 files changed, 21 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0b80ca7d/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java b/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
index 7934e78..80697f1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
@@ -409,6 +409,13 @@ public interface Cluster {
   Map<String, DesiredConfig> getDesiredConfigs();
 
   /**
+   * Gets the active desired configurations for the cluster.
+   * @param bypassCache don't use cached values
+   * @return a map of type-to-configuration information.
+   */
+  Map<String, DesiredConfig> getDesiredConfigs(boolean bypassCache);
+
+  /**
    * Gets all versions of the desired configurations for the cluster.
    * @return a map of type-to-configuration information.
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/0b80ca7d/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
index aa30b48..ac36ea9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java
@@ -119,7 +119,7 @@ public class ConfigHelper {
   private Map<String, Map<String, String>> getEffectiveDesiredTags(
       Cluster cluster, Map<String, HostConfig> hostConfigOverrides) {
 
-    Map<String, DesiredConfig> clusterDesired = (cluster == null) ? new HashMap<String, DesiredConfig>() : cluster.getDesiredConfigs();
+    Map<String, DesiredConfig> clusterDesired = (cluster == null) ? new HashMap<String, DesiredConfig>() : cluster.getDesiredConfigs(true);
 
     Map<String, Map<String, String>> resolved = new TreeMap<String, Map<String, String>>();
 
@@ -142,7 +142,7 @@ public class ConfigHelper {
 
         tags.put(CLUSTER_DEFAULT_TAG, config.getTag());
 
-      // AMBARI-3672. Only consider Config groups for override tags
+        // AMBARI-3672. Only consider Config groups for override tags
         // tags -> (configGroupId, versionTag)
         if (hostConfigOverrides != null) {
           HostConfig hostConfig = hostConfigOverrides.get(config.getType());

http://git-wip-us.apache.org/repos/asf/ambari/blob/0b80ca7d/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
index e51f7f7..784a2d4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
@@ -2185,7 +2185,7 @@ public class ClusterImpl implements Cluster {
    */
   @Override
   public Map<String, Set<DesiredConfig>> getAllDesiredConfigVersions() {
-    return getDesiredConfigs(true);
+    return getDesiredConfigs(true, false);
   }
 
   /**
@@ -2194,9 +2194,12 @@ public class ClusterImpl implements Cluster {
    */
   @Override
   public Map<String, DesiredConfig> getDesiredConfigs() {
+    return getDesiredConfigs(false);
+  }
 
-    Map<String, Set<DesiredConfig>> activeConfigsByType = getDesiredConfigs(false);
-
+  @Override
+  public Map<String, DesiredConfig> getDesiredConfigs(boolean bypassCache) {
+    Map<String, Set<DesiredConfig>> activeConfigsByType = getDesiredConfigs(false, bypassCache);
     return Maps.transformEntries(
         activeConfigsByType,
         new Maps.EntryTransformer<String, Set<DesiredConfig>, DesiredConfig>() {
@@ -2207,7 +2210,6 @@ public class ClusterImpl implements Cluster {
         });
   }
 
-
   /**
    * Gets desired configurations for the cluster.
    * @param allVersions specifies if all versions of the desired configurations to be returned
@@ -2215,14 +2217,17 @@ public class ClusterImpl implements Cluster {
    *                    desired configuration per config type.
    * @return a map of type-to-configuration information.
    */
-  private Map<String, Set<DesiredConfig>> getDesiredConfigs(boolean allVersions) {
+  private Map<String, Set<DesiredConfig>> getDesiredConfigs(boolean allVersions, boolean bypassCache) {
     loadConfigurations();
     clusterGlobalLock.readLock().lock();
     try {
       Map<String, Set<DesiredConfig>> map = new HashMap<>();
       Collection<String> types = new HashSet<>();
-
-      for (ClusterConfigMappingEntity e : getClusterEntity().getConfigMappingEntities()) {
+      Collection<ClusterConfigMappingEntity> entities =
+          bypassCache ?
+              clusterDAO.getClusterConfigMappingEntitiesByCluster(getClusterId()) :
+              getClusterEntity().getConfigMappingEntities();
+      for (ClusterConfigMappingEntity e : entities) {
         if (allVersions || e.isSelected() > 0) {
           DesiredConfig c = new DesiredConfig();
           c.setServiceName(null);