You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sm...@apache.org on 2016/01/12 19:34:20 UTC
ambari git commit: AMBARI-14491. ZOOKEEPER_SERVER INSTALL failed
(Oliver Szabo via smohanty)
Repository: ambari
Updated Branches:
refs/heads/branch-2.2 ac0053c44 -> 684a7b4e9
AMBARI-14491. ZOOKEEPER_SERVER INSTALL failed (Oliver Szabo via smohanty)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/684a7b4e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/684a7b4e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/684a7b4e
Branch: refs/heads/branch-2.2
Commit: 684a7b4e9f3c64b4739790da4e486f879dfd9b6d
Parents: ac0053c
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Tue Jan 12 10:21:17 2016 -0800
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Tue Jan 12 10:21:17 2016 -0800
----------------------------------------------------------------------
.../ambari/server/topology/TopologyManager.java | 23 +++++++++-------
.../apache/ambari/server/utils/StageUtils.java | 28 +++-----------------
.../server/controller/KerberosHelperTest.java | 2 +-
.../ambari/server/utils/StageUtilsTest.java | 2 +-
4 files changed, 19 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/684a7b4e/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
----------------------------------------------------------------------
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 7926628..41f3150 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
@@ -28,6 +28,7 @@ import org.apache.ambari.server.controller.ClusterRequest;
import org.apache.ambari.server.controller.KerberosHelper;
import org.apache.ambari.server.controller.RequestStatusResponse;
import org.apache.ambari.server.controller.internal.ArtifactResourceProvider;
+import org.apache.ambari.server.controller.internal.CalculatedStatus;
import org.apache.ambari.server.controller.internal.CredentialResourceProvider;
import org.apache.ambari.server.controller.internal.ProvisionClusterRequest;
import org.apache.ambari.server.controller.internal.RequestImpl;
@@ -459,20 +460,24 @@ public class TopologyManager {
return clusterTopologyMap.get(clusterId);
}
- public Map<String, Collection<String>> getProjectedTopology() {
+ public Map<String, Collection<String>> getPendingHostComponents() {
ensureInitialized();
Map<String, Collection<String>> hostComponentMap = new HashMap<String, Collection<String>>();
for (LogicalRequest logicalRequest : allRequests.values()) {
- 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);
+ 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);
+ }
+ hostComponents.addAll(entry.getValue());
}
- hostComponents.addAll(entry.getValue());
}
}
return hostComponentMap;
http://git-wip-us.apache.org/repos/asf/ambari/blob/684a7b4e/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java
----------------------------------------------------------------------
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 30843a4..69b9a43 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
@@ -277,7 +277,7 @@ public class StageUtils {
}
// add hosts from topology manager
- Map<String, Collection<String>> pendingHostComponents = topologyManager.getProjectedTopology();
+ Map<String, Collection<String>> pendingHostComponents = topologyManager.getPendingHostComponents();
for (String hostname : pendingHostComponents.keySet()) {
if (!hostsSet.contains(hostname)) {
hostsSet.add(hostname);
@@ -351,8 +351,6 @@ public class StageUtils {
}
// add components from topology manager
-
- Map<String, SortedSet<Integer>> hostRolesInfoFromTopology = new HashMap<String, SortedSet<Integer>>();
for (Map.Entry<String, Collection<String>> entry : pendingHostComponents.entrySet()) {
String hostname = entry.getKey();
Collection<String> hostComponents = entry.getValue();
@@ -376,11 +374,11 @@ public class StageUtils {
}
if (roleName != null) {
- SortedSet<Integer> hostsForComponentsHost = hostRolesInfoFromTopology.get(roleName);
+ SortedSet<Integer> hostsForComponentsHost = hostRolesInfo.get(roleName);
if (hostsForComponentsHost == null) {
hostsForComponentsHost = new TreeSet<Integer>();
- hostRolesInfoFromTopology.put(roleName, hostsForComponentsHost);
+ hostRolesInfo.put(roleName, hostsForComponentsHost);
}
int hostIndex = hostsList.indexOf(hostname);
@@ -398,13 +396,6 @@ public class StageUtils {
}
}
- // merge host roles
- for (Map.Entry<String, SortedSet<Integer>> entry : hostRolesInfoFromTopology.entrySet()) {
- if (isOverrideHostRoleNeeded(entry, hostRolesInfo, allHosts, pendingHostComponents)) {
- hostRolesInfo.put(entry.getKey(), entry.getValue());
- }
- }
-
Map<String, Set<String>> clusterHostInfo = new HashMap<String, Set<String>>();
for (Map.Entry<String, SortedSet<Integer>> entry : hostRolesInfo.entrySet()) {
@@ -590,17 +581,4 @@ public class StageUtils {
startOfRange + separator + endOfRange;
return rangeItem;
}
-
- /**
- * It determines to replace host roles if the number of components lower in the cluster than in the blueprint
- * or when all of the hosts are not available from {@link Cluster} object.
- */
- private static boolean isOverrideHostRoleNeeded(Entry<String, SortedSet<Integer>> hostRoleEntry,
- Map<String, SortedSet<Integer>> hostRolesInfo,
- Collection<Host> allHosts,
- Map<String, Collection<String>> pendingHostComponents) {
- Set<Integer> hostRole = hostRolesInfo.get(hostRoleEntry.getKey());
- return (allHosts.size() != pendingHostComponents.size() || (hostRole == null ||
- (!hostRole.isEmpty() && hostRole.size() < hostRoleEntry.getValue().size())));
- }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/684a7b4e/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
index 035d6b1..8861549 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
@@ -218,7 +218,7 @@ public class KerberosHelperTest extends EasyMockSupport {
setClusterController();
//todo: StageUtils shouldn't be called for this test
StageUtils.setTopologyManager(topologyManager);
- expect(topologyManager.getProjectedTopology()).andReturn(
+ expect(topologyManager.getPendingHostComponents()).andReturn(
Collections.<String, Collection<String>>emptyMap()).anyTimes();
CredentialStoreService credentialStoreService = injector.getInstance(CredentialStoreService.class);
http://git-wip-us.apache.org/repos/asf/ambari/blob/684a7b4e/ambari-server/src/test/java/org/apache/ambari/server/utils/StageUtilsTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/utils/StageUtilsTest.java b/ambari-server/src/test/java/org/apache/ambari/server/utils/StageUtilsTest.java
index 03bb7dc..2d663d9 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/utils/StageUtilsTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/utils/StageUtilsTest.java
@@ -527,7 +527,7 @@ public class StageUtilsTest extends EasyMockSupport {
final TopologyManager topologyManager = injector.getInstance(TopologyManager.class);
- topologyManager.getProjectedTopology();
+ topologyManager.getPendingHostComponents();
expectLastCall().andReturn(projectedTopology).once();
replayAll();