[ https://issues.apache.org/jira/browse/AMBARI-18376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15585686#comment-15585686 ]
Raymond edited comment on AMBARI-18376 at 10/18/16 3:07 PM: ------------------------------------------------------------ This seems like it should work on 2.4 as well, but not tested. {code} diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java index b3e3941..b7e5563 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java @@ -570,24 +570,26 @@ public class TopologyManager { return clusterTopologyMap.get(clusterId); } - public Map<String, Collection<String>> getPendingHostComponents() { + public Map<String, Collection<String>> getPendingHostComponents(String clusterName) { ensureInitialized(); Map<String, Collection<String>> hostComponentMap = new HashMap<String, Collection<String>>(); for (LogicalRequest logicalRequest : allRequests.values()) { Map<Long, HostRoleCommandStatusSummaryDTO> summary = logicalRequest.getStageSummaries(); - final CalculatedStatus status = CalculatedStatus.statusFromStageSummary(summary, summary.keySet()); - if (status.getStatus().isInProgress()) { - Map<String, Collection<String>> requestTopology = logicalRequest.getProjectedTopology(); - for (Map.Entry<String, Collection<String>> entry : requestTopology.entrySet()) { - String host = entry.getKey(); - Collection<String> hostComponents = hostComponentMap.get(host); - if (hostComponents == null) { - hostComponents = new HashSet<String>(); - hostComponentMap.put(host, hostComponents); + if (clusterName != null && clusterName.equals(logicalRequest.getClusterName())) { + final CalculatedStatus status = CalculatedStatus.statusFromStageSummary(summary, summary.keySet()); + if (status.getStatus().isInProgress()) { + Map<String, Collection<String>> requestTopology = logicalRequest.getProjectedTopology(); + for (Map.Entry<String, Collection<String>> entry : requestTopology.entrySet()) { + String host = entry.getKey(); + Collection<String> hostComponents = hostComponentMap.get(host); + if (hostComponents == null) { + hostComponents = new HashSet<String>(); + hostComponentMap.put(host, hostComponents); + } + hostComponents.addAll(entry.getValue()); + } } - hostComponents.addAll(entry.getValue()); - } } } return hostComponentMap; diff --git a/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java b/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java index 240bfc7..9232916 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java @@ -287,7 +287,7 @@ public class StageUtils { } // add hosts from topology manager - Map<String, Collection<String>> pendingHostComponents = topologyManager.getPendingHostComponents(); + Map<String, Collection<String>> pendingHostComponents = topologyManager.getPendingHostComponents(cluster.getClusterName()); for (String hostname : pendingHostComponents.keySet()) { if (!hostsSet.contains(hostname)) { hostsSet.add(hostname); {code} was (Author: rlee-pivotal): This seems like it should work on 2.4 as well, but not tested. ``` diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java index b3e3941..b7e5563 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java @@ -570,24 +570,26 @@ public class TopologyManager { return clusterTopologyMap.get(clusterId); } - public Map<String, Collection<String>> getPendingHostComponents() { + public Map<String, Collection<String>> getPendingHostComponents(String clusterName) { ensureInitialized(); Map<String, Collection<String>> hostComponentMap = new HashMap<String, Collection<String>>(); for (LogicalRequest logicalRequest : allRequests.values()) { Map<Long, HostRoleCommandStatusSummaryDTO> summary = logicalRequest.getStageSummaries(); - final CalculatedStatus status = CalculatedStatus.statusFromStageSummary(summary, summary.keySet()); - if (status.getStatus().isInProgress()) { - Map<String, Collection<String>> requestTopology = logicalRequest.getProjectedTopology(); - for (Map.Entry<String, Collection<String>> entry : requestTopology.entrySet()) { - String host = entry.getKey(); - Collection<String> hostComponents = hostComponentMap.get(host); - if (hostComponents == null) { - hostComponents = new HashSet<String>(); - hostComponentMap.put(host, hostComponents); + if (clusterName != null && clusterName.equals(logicalRequest.getClusterName())) { + final CalculatedStatus status = CalculatedStatus.statusFromStageSummary(summary, summary.keySet()); + if (status.getStatus().isInProgress()) { + Map<String, Collection<String>> requestTopology = logicalRequest.getProjectedTopology(); + for (Map.Entry<String, Collection<String>> entry : requestTopology.entrySet()) { + String host = entry.getKey(); + Collection<String> hostComponents = hostComponentMap.get(host); + if (hostComponents == null) { + hostComponents = new HashSet<String>(); + hostComponentMap.put(host, hostComponents); + } + hostComponents.addAll(entry.getValue()); + } } - hostComponents.addAll(entry.getValue()); - } } } return hostComponentMap; diff --git a/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java b/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java index 240bfc7..9232916 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java @@ -287,7 +287,7 @@ public class StageUtils { } // add hosts from topology manager - Map<String, Collection<String>> pendingHostComponents = topologyManager.getPendingHostComponents(); + Map<String, Collection<String>> pendingHostComponents = topologyManager.getPendingHostComponents(cluster.getClusterName()); for (String hostname : pendingHostComponents.keySet()) { if (!hostsSet.contains(hostname)) { hostsSet.add(hostname); ``` > Deploying 2 Clusters simultaneously results in one cluster failing. > ------------------------------------------------------------------- > > Key: AMBARI-18376 > URL: https://issues.apache.org/jira/browse/AMBARI-18376 > Project: Ambari > Issue Type: Bug > Affects Versions: 2.2.2 > Reporter: Raymond > Priority: Minor > Labels: patch > Fix For: 2.2.2 > > > Steps to Reproduce: > 1) Spin up an Ambari server node > 2) Setup 10 ambari agent nodes > 3) create 2 blueprints and 2 cluster templates with 5 nodes for each cluster > (hdfs, zookeeper, yarn) > 4) Upload both blueprints using the ambari api > 5) Upload both cluster templates using the ambari api > One cluster will fail, ssh into one of the nodes (with a zookeeper server) on > the failed cluster. > Find the zoo.cfg file in /etc/zookeeper (find /etc/zookeeper -name zoo.cfg) > Actual: cat the zoo.cfg, notice all hostnames of both clusters are in this > file > Expected: zoo.cfg should contain only the hostnames defined for this cluster. -- This message was sent by Atlassian JIRA (v6.3.4#6332)