ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject ambari git commit: AMBARI-11848. It is not possible to upgrade cluster after upgrade canceling (ncole)
Date Thu, 11 Jun 2015 01:41:10 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 83ce96d76 -> a18e7f408


AMBARI-11848. It is not possible to upgrade cluster after upgrade canceling (ncole)


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

Branch: refs/heads/branch-2.1
Commit: a18e7f408f93fcdb024b7f2bd9c14770016139e6
Parents: 83ce96d
Author: Nate Cole <ncole@hortonworks.com>
Authored: Wed Jun 10 20:00:37 2015 -0400
Committer: Nate Cole <ncole@hortonworks.com>
Committed: Wed Jun 10 20:00:37 2015 -0400

----------------------------------------------------------------------
 .../upgrades/FinalizeUpgradeAction.java         |  3 +--
 .../upgrades/UpgradeActionTest.java             | 24 +++++++++++++++++++-
 2 files changed, 24 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a18e7f40/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
index f1af7c4..6ede46b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
@@ -266,7 +266,6 @@ public class FinalizeUpgradeAction extends AbstractServerAction {
 
     try {
       Cluster cluster = clusters.getCluster(clusterName);
-      StackId desiredClusterStackId = cluster.getDesiredStackVersion();
       StackId currentClusterStackId = cluster.getCurrentStackVersion();
 
       // this was a cross-stack upgrade, meaning that configurations were
@@ -321,7 +320,7 @@ public class FinalizeUpgradeAction extends AbstractServerAction {
       Set<String> badHosts = new HashSet<String>();
       for (String badVersion : badVersions) {
         List<HostVersionEntity> hostVersions = hostVersionDAO.findByClusterStackAndVersion(
-            clusterName, desiredClusterStackId, badVersion);
+            clusterName, targetStackId, badVersion);
 
         for (HostVersionEntity hostVersion : hostVersions) {
           badHosts.add(hostVersion.getHostName());

http://git-wip-us.apache.org/repos/asf/ambari/blob/a18e7f40/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
index 4048635..209f2ba 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
@@ -18,15 +18,16 @@
 package org.apache.ambari.server.serveraction.upgrades;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
-import com.google.inject.persist.UnitOfWork;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.ServiceComponentNotFoundException;
 import org.apache.ambari.server.ServiceNotFoundException;
@@ -77,6 +78,7 @@ import com.google.inject.Guice;
 import com.google.inject.Inject;
 import com.google.inject.Injector;
 import com.google.inject.persist.PersistService;
+import com.google.inject.persist.UnitOfWork;
 
 /**
  * Tests upgrade-related server side actions
@@ -469,6 +471,16 @@ public class UpgradeActionTest {
 
     hostRoleCommand.setExecutionCommandWrapper(new ExecutionCommandWrapper(executionCommand));
 
+
+    HostVersionDAO dao = m_injector.getInstance(HostVersionDAO.class);
+
+    List<HostVersionEntity> hosts = dao.findByClusterStackAndVersion(
+        "c1", HDP_22_STACK, HDP_2_2_1_0);
+    assertFalse(hosts.isEmpty());
+    for (HostVersionEntity hve : hosts) {
+      assertFalse(hve.getState() == RepositoryVersionState.INSTALLED);
+    }
+
     FinalizeUpgradeAction action = m_injector.getInstance(FinalizeUpgradeAction.class);
     action.setExecutionCommand(executionCommand);
     action.setHostRoleCommand(hostRoleCommand);
@@ -489,6 +501,16 @@ public class UpgradeActionTest {
     cluster = clusters.getCluster("c1");
     configs = cluster.getAllConfigs();
     assertEquals(3, configs.size());
+
+    hosts = dao.findByClusterStackAndVersion(
+        "c1", HDP_22_STACK, HDP_2_2_1_0);
+
+    hosts = dao.findByClusterStackAndVersion("c1", HDP_22_STACK, HDP_2_2_1_0);
+    assertFalse(hosts.isEmpty());
+    for (HostVersionEntity hve : hosts) {
+      assertTrue(hve.getState() == RepositoryVersionState.INSTALLED);
+    }
+
   }
 
   private ServiceComponentHost createNewServiceComponentHost(Cluster cluster, String svc,


Mime
View raw message