Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714 63d938fe9 -> bfeaa1071


AMBARI-22604 Fix hostConfigMappingEntity cluster_id, concurrency in ClusterImpl 
and serviceConfigTypes initialization. Addendum patch (dsen)


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

Branch: refs/heads/branch-feature-AMBARI-14714
Commit: bfeaa1071ea9af693a6af03a7654f03b38f4157c
Parents: 63d938f
Author: Dmytro Sen <d...@apache.org>
Authored: Thu Dec 14 11:44:35 2017 +0200
Committer: Dmytro Sen <d...@apache.org>
Committed: Thu Dec 14 11:44:35 2017 +0200

----------------------------------------------------------------------
 .../org/apache/ambari/server/state/cluster/ClusterImpl.java   | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bfeaa107/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 7ca13e8..bdda9a7 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
@@ -2133,12 +2133,13 @@ public class ClusterImpl implements Cluster {
 
     for (Long serviceId : serviceConfigTypes.keySet()) {
       Set<String> configTypesForServiceId = serviceConfigTypes.get(serviceId);
-      if (configTypesForServiceId.containsAll(configTypes) && 
configTypesForServiceId.size() == configTypes.size()) {
+      if (configTypesForServiceId.containsAll(configTypes)) {
           resultingServiceIds.add(serviceId);
       }
     }
     if (resultingServiceIds.isEmpty()) {
       LOG.warn("Can't find serviceIds for {}, there is a problem if there's no 
cluster-env", configTypes);
+      return null;
     } else {
       LOG.info("Service {} returning", 
getServiceOrNull(resultingServiceIds.get(0)));
     }
@@ -2156,6 +2157,10 @@ public class ClusterImpl implements Cluster {
         resultingServiceIds.add(serviceId);
       }
     }
+    if (resultingServiceIds.isEmpty()) {
+      LOG.warn("Can't find service for {}", configType);
+      return null;
+    }
     //TODO this needs to be reworked to support multiple instance of same 
service
     return getServiceOrNull(resultingServiceIds.get(0));
   }

Reply via email to