ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oleew...@apache.org
Subject ambari git commit: AMBARI-16230. Sporadic errors when deploying the cluster (oleewere)
Date Fri, 13 May 2016 15:13:33 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 7d6d24743 -> ca630b868


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


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

Branch: refs/heads/trunk
Commit: ca630b868ed27b1c6ead3b645f453387c84586fb
Parents: 7d6d247
Author: oleewere <oleewere@gmail.com>
Authored: Fri May 13 15:52:57 2016 +0200
Committer: oleewere <oleewere@gmail.com>
Committed: Fri May 13 17:11:51 2016 +0200

----------------------------------------------------------------------
 .../controller/internal/ServiceResourceProvider.java    |  1 -
 .../java/org/apache/ambari/server/state/Cluster.java    |  2 +-
 .../org/apache/ambari/server/state/ServiceImpl.java     |  1 +
 .../apache/ambari/server/state/cluster/ClusterImpl.java |  8 +-------
 .../org/apache/ambari/server/events/EventsTest.java     |  1 -
 .../org/apache/ambari/server/orm/OrmTestHelper.java     |  8 ++++++--
 .../server/state/alerts/AlertEventPublisherTest.java    |  1 -
 .../server/state/alerts/InitialAlertEventTest.java      |  1 -
 .../apache/ambari/server/state/cluster/ClusterTest.java | 12 ------------
 9 files changed, 9 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ca630b86/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 47342f3..56196c1 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,7 +356,6 @@ 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/ca630b86/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java b/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
index 303b043..9c0052f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
@@ -66,7 +66,7 @@ public interface Cluster {
    * Add a service to a cluster
    * @param service
    */
-  void addService(Service service) throws AmbariException;
+  void addService(Service service);
 
   /**
    * Get a service

http://git-wip-us.apache.org/repos/asf/ambari/blob/ca630b86/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 487489b..3120b86 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,6 +475,7 @@ public class ServiceImpl implements Service {
 
           // publish the service installed event
           StackId stackId = cluster.getDesiredStackVersion();
+          cluster.addService(this);
 
           ServiceInstalledEvent event = new ServiceInstalledEvent(
               getClusterId(), stackId.getStackName(),

http://git-wip-us.apache.org/repos/asf/ambari/blob/ca630b86/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 108732f..13eea58 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
@@ -944,8 +944,7 @@ public class ClusterImpl implements Cluster {
   }
 
   @Override
-  public void addService(Service service)
-    throws AmbariException {
+  public void addService(Service service) {
     loadServices();
     clusterGlobalLock.writeLock().lock();
     try {
@@ -954,11 +953,6 @@ public class ClusterImpl implements Cluster {
           + ", clusterId=" + getClusterId() + ", serviceName="
           + service.getName());
       }
-      if (services.containsKey(service.getName())) {
-        throw new AmbariException("Service already exists" + ", clusterName="
-            + getClusterName() + ", clusterId=" + getClusterId()
-            + ", serviceName=" + service.getName());
-      }
       services.put(service.getName(), service);
     } finally {
       clusterGlobalLock.writeLock().unlock();

http://git-wip-us.apache.org/repos/asf/ambari/blob/ca630b86/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 a3d05a9..ce86f83 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,7 +382,6 @@ 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/ca630b86/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 19146fd..1bfcfb9 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
@@ -58,6 +58,7 @@ import org.apache.ambari.server.orm.entities.AlertGroupEntity;
 import org.apache.ambari.server.orm.entities.AlertTargetEntity;
 import org.apache.ambari.server.orm.entities.ClusterEntity;
 import org.apache.ambari.server.orm.entities.ClusterServiceEntity;
+import org.apache.ambari.server.orm.entities.ClusterStateEntity;
 import org.apache.ambari.server.orm.entities.HostEntity;
 import org.apache.ambari.server.orm.entities.HostRoleCommandEntity;
 import org.apache.ambari.server.orm.entities.HostStateEntity;
@@ -347,6 +348,11 @@ public class OrmTestHelper {
 
     clusterDAO.create(clusterEntity);
 
+    ClusterStateEntity clusterStateEntity = new ClusterStateEntity();
+    clusterStateEntity.setCurrentStack(stackEntity);
+    clusterStateEntity.setClusterEntity(clusterEntity);
+    getEntityManager().persist(clusterStateEntity);
+
     clusterEntity = clusterDAO.findByName(clusterEntity.getClusterName());
     assertNotNull(clusterEntity);
     assertTrue(clusterEntity.getClusterId() > 0);
@@ -415,7 +421,6 @@ 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);
@@ -461,7 +466,6 @@ 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/ca630b86/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 d1b27a9..76aa2e4 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,7 +304,6 @@ 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/ca630b86/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 1875ba6..fc4803b 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,7 +175,6 @@ 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);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ca630b86/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
index e7cbd99..7dc8bf8 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
@@ -685,21 +685,9 @@ public class ClusterTest {
     Service s1 = serviceFactory.createNew(c1, "HDFS");
     Service s2 = serviceFactory.createNew(c1, "MAPREDUCE");
 
-    c1.addService(s1);
-    c1.addService(s2);
-
     s1.persist();
     s2.persist();
 
-    Service s3 = serviceFactory.createNew(c1, "MAPREDUCE");
-
-    try {
-      c1.addService(s3);
-      fail("Expected error on adding dup service");
-    } catch (Exception e) {
-      // Expected
-    }
-
     Service s = c1.getService("HDFS");
     Assert.assertNotNull(s);
     Assert.assertEquals("HDFS", s.getName());


Mime
View raw message