ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpapirkovs...@apache.org
Subject ambari git commit: AMBARI-15560. Client components use incorrect state machine. (mpapirkovskyy)
Date Thu, 24 Mar 2016 16:59:15 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 a119ab4f8 -> 69a1f1278


AMBARI-15560. Client components use incorrect state machine. (mpapirkovskyy)


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

Branch: refs/heads/branch-2.2
Commit: 69a1f127809d65b3d59b88dadff95fd27a84739e
Parents: a119ab4
Author: Myroslav Papirkovskyi <mpapyrkovskyy@hortonworks.com>
Authored: Thu Mar 24 17:55:38 2016 +0200
Committer: Myroslav Papirkovskyi <mpapyrkovskyy@hortonworks.com>
Committed: Thu Mar 24 17:55:48 2016 +0200

----------------------------------------------------------------------
 .../server/state/ServiceComponentImpl.java      | 40 ++++++++++----------
 .../svccomphost/ServiceComponentHostImpl.java   |  5 +++
 2 files changed, 25 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/69a1f127/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
index 71dcbca..1275e9f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
@@ -130,6 +130,24 @@ public class ServiceComponentImpl implements ServiceComponent {
     desiredStateEntity = serviceComponentDesiredStateEntity;
     this.componentName = serviceComponentDesiredStateEntity.getComponentName();
 
+    StackId stackId = service.getDesiredStackVersion();
+    try {
+      ComponentInfo compInfo = ambariMetaInfo.getComponent(
+        stackId.getStackName(), stackId.getStackVersion(), service.getName(),
+        componentName);
+      isClientComponent = compInfo.isClient();
+      isMasterComponent = compInfo.isMaster();
+      isVersionAdvertised = compInfo.isVersionAdvertised();
+      displayName = compInfo.getDisplayName();
+    } catch (ObjectNotFoundException e) {
+      throw new AmbariException("Trying to create a ServiceComponent"
+        + " not recognized in stack info"
+        + ", clusterName=" + service.getCluster().getClusterName()
+        + ", serviceName=" + service.getName()
+        + ", componentName=" + componentName
+        + ", stackInfo=" + stackId.getStackId());
+    }
+
     hostComponents = new HashMap<String, ServiceComponentHost>();
     for (HostComponentStateEntity hostComponentStateEntity : desiredStateEntity.getHostComponentStateEntities())
{
       HostComponentDesiredStateEntityPK pk = new HostComponentDesiredStateEntityPK();
@@ -144,32 +162,14 @@ public class ServiceComponentImpl implements ServiceComponent {
           serviceComponentHostFactory.createExisting(this,
             hostComponentStateEntity, hostComponentDesiredStateEntity));
       } catch(ProvisionException ex) {
-        StackId stackId = service.getCluster().getCurrentStackVersion();
+        StackId currentStackId = service.getCluster().getCurrentStackVersion();
         LOG.error(String.format("Can not get host component info: stackName=%s, stackVersion=%s,
serviceName=%s, componentName=%s, hostname=%s",
-          stackId.getStackName(), stackId.getStackVersion(),
+          currentStackId.getStackName(), currentStackId.getStackVersion(),
           service.getName(),serviceComponentDesiredStateEntity.getComponentName(), hostComponentStateEntity.getHostName()));
         ex.printStackTrace();
       }
     }
 
-    StackId stackId = service.getDesiredStackVersion();
-    try {
-      ComponentInfo compInfo = ambariMetaInfo.getComponent(
-          stackId.getStackName(), stackId.getStackVersion(), service.getName(),
-          componentName);
-      isClientComponent = compInfo.isClient();
-      isMasterComponent = compInfo.isMaster();
-      isVersionAdvertised = compInfo.isVersionAdvertised();
-      displayName = compInfo.getDisplayName();
-    } catch (ObjectNotFoundException e) {
-      throw new AmbariException("Trying to create a ServiceComponent"
-          + " not recognized in stack info"
-          + ", clusterName=" + service.getCluster().getClusterName()
-          + ", serviceName=" + service.getName()
-          + ", componentName=" + componentName
-          + ", stackInfo=" + stackId.getStackId());
-    }
-
     desiredStateEntityPK = getDesiredStateEntityPK(desiredStateEntity);
 
     persisted = true;

http://git-wip-us.apache.org/repos/asf/ambari/blob/69a1f127/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
index 26aad07..101d849 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
@@ -498,6 +498,11 @@ public class ServiceComponentHostImpl implements ServiceComponentHost
{
          ServiceComponentHostEventType.HOST_SVCCOMP_OP_FAILED,
          new ServiceComponentHostOpCompletedTransition())
 
+     .addTransition(State.INSTALL_FAILED,
+         State.INSTALL_FAILED,
+         ServiceComponentHostEventType.HOST_SVCCOMP_OP_IN_PROGRESS,
+         new ServiceComponentHostOpInProgressTransition())
+
     .addTransition(State.INSTALLED,
          State.INSTALLED,
          ServiceComponentHostEventType.HOST_SVCCOMP_OP_SUCCEEDED,


Mime
View raw message