ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject [1/2] ambari git commit: AMBARI-15160. YARN restart icon appeared after 5 minutes after reconfig (aonishuk)
Date Wed, 02 Mar 2016 18:06:43 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 8ccbf8fb1 -> 0b80ca7d2
  refs/heads/trunk 2ab290e00 -> ba41f2a9e


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

Branch: refs/heads/trunk
Commit: ba41f2a9e650923a8ae832e12ca3bae237939ed8
Parents: 2ab290e
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Wed Mar 2 20:06:36 2016 +0200
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Wed Mar 2 20:06:36 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/ba41f2a9/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 f26f471..ed3c772 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
@@ -416,6 +416,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/ba41f2a9/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 d311017..6172fad 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
@@ -120,7 +120,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>>();
 
@@ -143,7 +143,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/ba41f2a9/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 0592c05..116602b 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
@@ -2190,7 +2190,7 @@ public class ClusterImpl implements Cluster {
    */
   @Override
   public Map<String, Set<DesiredConfig>> getAllDesiredConfigVersions() {
-    return getDesiredConfigs(true);
+    return getDesiredConfigs(true, false);
   }
 
   /**
@@ -2199,9 +2199,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>()
{
@@ -2212,7 +2215,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
@@ -2220,14 +2222,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);


Mime
View raw message