ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vbrodets...@apache.org
Subject ambari git commit: AMBARI-14248. After ambari-server upgrade "start all" operation is triggered with 1 minute delay.(vbrodetskyi)
Date Mon, 07 Dec 2015 14:47:55 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 01820d6f0 -> a0d8e722c


AMBARI-14248. After ambari-server upgrade "start all" operation is triggered with 1 minute
delay.(vbrodetskyi)


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

Branch: refs/heads/trunk
Commit: a0d8e722c643c676f8e2b0b4dd5e1ee7a77cb56a
Parents: 01820d6
Author: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Authored: Mon Dec 7 16:47:10 2015 +0200
Committer: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Committed: Mon Dec 7 16:47:10 2015 +0200

----------------------------------------------------------------------
 .../ambari/server/state/ConfigHelper.java       | 55 +++++++++++---------
 1 file changed, 30 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a0d8e722/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 2acd62b..57d4db4 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
@@ -17,20 +17,12 @@
  */
 package org.apache.ambari.server.state;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.concurrent.TimeUnit;
-
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.collect.Maps;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.google.inject.persist.Transactional;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.configuration.Configuration;
@@ -44,12 +36,19 @@ import org.apache.ambari.server.upgrade.UpgradeCatalog170;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.cache.Cache;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.collect.Maps;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import com.google.inject.persist.Transactional;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.concurrent.TimeUnit;
 
 /**
  * Helper class that works with config traversals.
@@ -463,18 +462,24 @@ public class ConfigHelper {
   }
 
   public Set<String> getPropertyValuesWithPropertyType(StackId stackId, PropertyType
propertyType, Cluster cluster) throws AmbariException {
-    StackInfo stack = ambariMetaInfo.getStack(stackId.getStackName(),
-        stackId.getStackVersion());
-
+    StackInfo stack = ambariMetaInfo.getStack(stackId.getStackName(), stackId.getStackVersion());
+    Map<String, DesiredConfig> desiredConfigs = cluster.getDesiredConfigs();
+    Map<String, Config> actualConfigs = new HashMap<>();
     Set<String> result = new HashSet<String>();
 
+    for (Map.Entry<String, DesiredConfig> desiredConfigEntry : desiredConfigs.entrySet())
{
+      String configType = desiredConfigEntry.getKey();
+      DesiredConfig desiredConfig = desiredConfigEntry.getValue();
+      actualConfigs.put(configType, cluster.getConfig(configType, desiredConfig.getTag()));
+    }
+
     for (Service service : cluster.getServices().values()) {
       Set<PropertyInfo> serviceProperties = ambariMetaInfo.getServiceProperties(stack.getName(),
stack.getVersion(), service.getName());
       for (PropertyInfo serviceProperty : serviceProperties) {
         if (serviceProperty.getPropertyTypes().contains(propertyType)) {
           String stackPropertyConfigType = fileNameToConfigType(serviceProperty.getFilename());
           try {
-            result.add(cluster.getDesiredConfigByType(stackPropertyConfigType).getProperties().get(serviceProperty.getName()));
+            result.add(actualConfigs.get(stackPropertyConfigType).getProperties().get(serviceProperty.getName()));
           } catch (Exception ex) {
           }
         }
@@ -486,7 +491,7 @@ public class ConfigHelper {
     for (PropertyInfo stackProperty : stackProperties) {
       if (stackProperty.getPropertyTypes().contains(propertyType)) {
         String stackPropertyConfigType = fileNameToConfigType(stackProperty.getFilename());
-        result.add(cluster.getDesiredConfigByType(stackPropertyConfigType).getProperties().get(stackProperty.getName()));
+        result.add(actualConfigs.get(stackPropertyConfigType).getProperties().get(stackProperty.getName()));
       }
     }
 


Mime
View raw message