ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathanhur...@apache.org
Subject ambari git commit: Revert "AMBARI-16230. Sporadic errors when deploying the cluster (oleewere)"
Date Wed, 11 May 2016 20:05:09 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 40823388e -> 63ede8195


Revert "AMBARI-16230. Sporadic errors when deploying the cluster (oleewere)"

This reverts commit 84c3e7f06e1fb2e55d37f046ec584407c0b5c8eb.


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

Branch: refs/heads/trunk
Commit: 63ede81959381698ecffe035c00a050fbb08316b
Parents: 4082338
Author: Jonathan Hurley <jhurley@hortonworks.com>
Authored: Wed May 11 16:01:00 2016 -0400
Committer: Jonathan Hurley <jhurley@hortonworks.com>
Committed: Wed May 11 16:05:01 2016 -0400

----------------------------------------------------------------------
 .../controller/internal/ServiceResourceProvider.java |  1 +
 .../org/apache/ambari/server/state/ServiceImpl.java  |  3 ---
 .../ambari/server/state/cluster/ClusterImpl.java     | 15 ++++++++++-----
 .../org/apache/ambari/server/events/EventsTest.java  |  1 +
 .../org/apache/ambari/server/orm/OrmTestHelper.java  |  2 ++
 .../server/state/alerts/AlertEventPublisherTest.java |  1 +
 .../server/state/alerts/InitialAlertEventTest.java   |  1 +
 7 files changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/63ede819/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
index 56196c1..47342f3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
@@ -356,6 +356,7 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider
       s.setDesiredState(state);
       s.setDesiredStackVersion(cluster.getDesiredStackVersion());
       s.persist();
+      cluster.addService(s);
       // Initialize service widgets
       getManagementController().initializeWidgetsAndLayouts(cluster, s);
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/63ede819/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
index c47bbbc..487489b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
@@ -475,7 +475,6 @@ public class ServiceImpl implements Service {
 
           // publish the service installed event
           StackId stackId = cluster.getDesiredStackVersion();
-          cluster.addService(this);
 
           ServiceInstalledEvent event = new ServiceInstalledEvent(
               getClusterId(), stackId.getStackName(),
@@ -485,8 +484,6 @@ public class ServiceImpl implements Service {
         } else {
           saveIfPersisted();
         }
-      } catch (AmbariException e) {
-        LOG.error("Adding service '{}' is failed before publishing service installed event.",
getName(), e);
       } finally {
         readWriteLock.writeLock().unlock();
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/63ede819/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 85ca2c7..108732f 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
@@ -172,7 +172,7 @@ public class ClusterImpl implements Cluster {
 
   private volatile boolean desiredStackVersionSet = true;
 
-  private Map<String, Service> services = null;
+  private volatile Map<String, Service> services = null;
 
   /**
    * [ Config Type -> [ Config Version Tag -> Config ] ]
@@ -322,8 +322,6 @@ public class ClusterImpl implements Cluster {
       loadServiceConfigTypes();
     }
 
-    loadServices();
-
     // register to receive stuff
     eventPublisher.register(this);
     this.eventPublisher = eventPublisher;
@@ -376,6 +374,7 @@ public class ClusterImpl implements Cluster {
    * We need this for live status checks.
    */
   public void loadServiceHostComponents() {
+    loadServices();
     if (svcHostsLoaded) {
       return;
     }
@@ -947,6 +946,7 @@ public class ClusterImpl implements Cluster {
   @Override
   public void addService(Service service)
     throws AmbariException {
+    loadServices();
     clusterGlobalLock.writeLock().lock();
     try {
       if (LOG.isDebugEnabled()) {
@@ -967,6 +967,7 @@ public class ClusterImpl implements Cluster {
 
   @Override
   public Service addService(String serviceName) throws AmbariException {
+    loadServices();
     clusterGlobalLock.writeLock().lock();
     try {
       if (LOG.isDebugEnabled()) {
@@ -988,6 +989,7 @@ public class ClusterImpl implements Cluster {
 
   @Override
   public Service getService(String serviceName) throws AmbariException {
+    loadServices();
     clusterGlobalLock.readLock().lock();
     try {
       if (!services.containsKey(serviceName)) {
@@ -1001,6 +1003,7 @@ public class ClusterImpl implements Cluster {
 
   @Override
   public Map<String, Service> getServices() {
+    loadServices();
     clusterGlobalLock.readLock().lock();
     try {
       return new HashMap<String, Service>(services);
@@ -2107,6 +2110,7 @@ public class ClusterImpl implements Cluster {
 
   @Override
   public void debugDump(StringBuilder sb) {
+    loadServices();
     loadStackVersion();
     clusterGlobalLock.readLock().lock();
     try {
@@ -2145,6 +2149,7 @@ public class ClusterImpl implements Cluster {
   @Override
   @Transactional
   public void deleteAllServices() throws AmbariException {
+    loadServices();
     clusterGlobalLock.writeLock().lock();
     try {
       LOG.info("Deleting all services for cluster" + ", clusterName="
@@ -2170,6 +2175,7 @@ public class ClusterImpl implements Cluster {
   @Override
   public void deleteService(String serviceName)
     throws AmbariException {
+    loadServices();
     clusterGlobalLock.writeLock().lock();
     try {
       Service service = getService(serviceName);
@@ -2218,6 +2224,7 @@ public class ClusterImpl implements Cluster {
 
   @Override
   public boolean canBeRemoved() {
+    loadServices();
     clusterGlobalLock.readLock().lock();
     try {
       boolean safeToRemove = true;
@@ -3533,8 +3540,6 @@ public class ClusterImpl implements Cluster {
 
       refresh();
 
-      loadServices();
-
     } finally {
       clusterGlobalLock.writeLock().unlock();
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/63ede819/ambari-server/src/test/java/org/apache/ambari/server/events/EventsTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/events/EventsTest.java b/ambari-server/src/test/java/org/apache/ambari/server/events/EventsTest.java
index ce86f83..a3d05a9 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/events/EventsTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/events/EventsTest.java
@@ -382,6 +382,7 @@ public class EventsTest {
   private void installHdfsService() throws Exception {
     String serviceName = "HDFS";
     Service service = m_serviceFactory.createNew(m_cluster, serviceName);
+    m_cluster.addService(service);
     service.persist();
     service = m_cluster.getService(serviceName);
     Assert.assertNotNull(service);

http://git-wip-us.apache.org/repos/asf/ambari/blob/63ede819/ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java
index ea48703..19146fd 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java
@@ -415,6 +415,7 @@ public class OrmTestHelper {
       ServiceComponentHostFactory schFactory, String hostName) throws Exception {
     String serviceName = "HDFS";
     Service service = serviceFactory.createNew(cluster, serviceName);
+    cluster.addService(service);
     service.persist();
     service = cluster.getService(serviceName);
     assertNotNull(service);
@@ -460,6 +461,7 @@ public class OrmTestHelper {
       ServiceComponentHostFactory schFactory, String hostName) throws Exception {
     String serviceName = "YARN";
     Service service = serviceFactory.createNew(cluster, serviceName);
+    cluster.addService(service);
     service.persist();
     service = cluster.getService(serviceName);
     assertNotNull(service);

http://git-wip-us.apache.org/repos/asf/ambari/blob/63ede819/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertEventPublisherTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertEventPublisherTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertEventPublisherTest.java
index 76aa2e4..d1b27a9 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertEventPublisherTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertEventPublisherTest.java
@@ -304,6 +304,7 @@ public class AlertEventPublisherTest {
   private void installHdfsService() throws Exception {
     String serviceName = "HDFS";
     Service service = serviceFactory.createNew(cluster, serviceName);
+    cluster.addService(service);
     service.persist();
     service = cluster.getService(serviceName);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/63ede819/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/InitialAlertEventTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/InitialAlertEventTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/InitialAlertEventTest.java
index fc4803b..1875ba6 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/InitialAlertEventTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/InitialAlertEventTest.java
@@ -175,6 +175,7 @@ public class InitialAlertEventTest {
   private void installHdfsService() throws Exception {
     String serviceName = "HDFS";
     Service service = m_serviceFactory.createNew(m_cluster, serviceName);
+    m_cluster.addService(service);
     service.persist();
     service = m_cluster.getService(serviceName);
 


Mime
View raw message