You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2017/07/21 04:38:11 UTC
[11/23] ambari git commit: AMBARI-21521 Include/exclude files update
is triggered when master is not started if cluster is deployed via BP (dsen)
AMBARI-21521 Include/exclude files update is triggered when master is not started if cluster is deployed via BP (dsen)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/05e7043c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/05e7043c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/05e7043c
Branch: refs/heads/branch-feature-AMBARI-21450
Commit: 05e7043cb20c2b88ac0442ae28eca1d3dfef7911
Parents: dc9bf08
Author: Dmytro Sen <ds...@apache.org>
Authored: Wed Jul 19 18:38:00 2017 +0300
Committer: Dmytro Sen <ds...@apache.org>
Committed: Wed Jul 19 18:41:59 2017 +0300
----------------------------------------------------------------------
.../controller/AmbariManagementControllerImpl.java | 15 +++++++++++++--
.../AmbariManagementControllerImplTest.java | 1 -
2 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/05e7043c/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index cccb4b2..850838d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -3362,9 +3362,8 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
}
}
try {
- Service s = cluster.getService(serviceName);
//Filter services whose masters are not started
- if (s.getServiceComponent(masterComponentName).getDesiredState() == State.STARTED) {
+ if (isServiceComponentStartedOnAnyHost(cluster, serviceName, masterComponentName)) {
serviceMasterForDecommissionMap.put(serviceName, masterComponentName);
} else {
LOG.info(String.format("Not adding %s service from include/exclude files refresh map because it's master is not started", serviceName));
@@ -3393,6 +3392,18 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
}
}
+ private boolean isServiceComponentStartedOnAnyHost(Cluster cluster, String serviceName, String masterComponentName) throws AmbariException {
+ Service service = cluster.getService(serviceName);
+ ServiceComponent serviceComponent = service.getServiceComponent(masterComponentName);
+ Map<String, ServiceComponentHost> schMap = serviceComponent.getServiceComponentHosts();
+ for (ServiceComponentHost sch : schMap.values()) {
+ if (sch.getState() == State.STARTED) {
+ return true;
+ }
+ }
+ return false;
+ }
+
@Override
public RequestStatusResponse createAndPersistStages(Cluster cluster, Map<String, String> requestProperties,
Map<String, String> requestParameters,
http://git-wip-us.apache.org/repos/asf/ambari/blob/05e7043c/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
index 085b746..35aa37f 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
@@ -2409,5 +2409,4 @@ public class AmbariManagementControllerImplTest {
verify(injector, clusters, ambariMetaInfo, stackInfo, cluster, repoVersionDAO, repoVersion, clusterVersionDAO);
}
-
}