ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmitriu...@apache.org
Subject ambari git commit: AMBARI-9407. Install Version aborting cause infinite Installing state (dlysnichenko)
Date Fri, 30 Jan 2015 11:24:33 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 876b1969c -> bfa0e4aec


AMBARI-9407. Install Version aborting cause infinite Installing state (dlysnichenko)


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

Branch: refs/heads/trunk
Commit: bfa0e4aec8279db13afc4cb55e7919591894f1c4
Parents: 876b196
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Fri Jan 30 13:23:51 2015 +0200
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Fri Jan 30 13:23:51 2015 +0200

----------------------------------------------------------------------
 .../DistributeRepositoriesActionListener.java   | 23 +++++++++-----------
 1 file changed, 10 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bfa0e4ae/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/DistributeRepositoriesActionListener.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/DistributeRepositoriesActionListener.java
b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/DistributeRepositoriesActionListener.java
index 0f06f6e..e4b26b1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/DistributeRepositoriesActionListener.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/DistributeRepositoriesActionListener.java
@@ -152,24 +152,21 @@ public class DistributeRepositoriesActionListener {
       }
     }
 
-    if (repositoryVersion != null) {
-      List<HostVersionEntity> hostVersions = hostVersionDAO.get().findByHost(event.getHostname());
-      HostVersionEntity foundHostVersion = null;
-
-      for (HostVersionEntity hostVersion : hostVersions) {
-        if (hostVersion.getRepositoryVersion().getVersion().equals(repositoryVersion)) {
-          foundHostVersion = hostVersion;
-          break;
-        }
+    List<HostVersionEntity> hostVersions = hostVersionDAO.get().findByHost(event.getHostname());
+    // We have to iterate over all host versions. Otherwise server-side command aborts (that
do not
+    // provide exact host stack version info) would be ignored
+    for (HostVersionEntity hostVersion : hostVersions) {
+      if (repositoryVersion != null && ! hostVersion.getRepositoryVersion().getVersion().equals(repositoryVersion))
{
+        continue;
       }
-
-      if (foundHostVersion != null && foundHostVersion.getState() == RepositoryVersionState.INSTALLING)
{
-        foundHostVersion.setState(newHostState);
+      // If we know exact host stack version, there will be single execution of a code below
+      if (hostVersion.getState() == RepositoryVersionState.INSTALLING) {
+        hostVersion.setState(newHostState);
 
         // Update state of a cluster stack version
         try {
           Cluster cluster = clusters.get().getClusterById(clusterId);
-          cluster.recalculateClusterVersionState(foundHostVersion.getRepositoryVersion().getVersion());
+          cluster.recalculateClusterVersionState(hostVersion.getRepositoryVersion().getVersion());
         } catch (AmbariException e) {
           LOG.error("Cannot get cluster with Id " + clusterId.toString(), e);
         }


Mime
View raw message