ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmitriu...@apache.org
Subject [1/4] ambari git commit: AMBARI-12425. Manual Stack Upgrade - Unable to set current after upgrade from 2.2 -> 2.3 (dlysnichenko)
Date Thu, 16 Jul 2015 19:01:44 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 7f9b3cf67 -> 8136c94d4
  refs/heads/trunk 58802fbef -> f6ea3c60b


AMBARI-12425. Manual Stack Upgrade - Unable to set current after upgrade from 2.2 -> 2.3
(dlysnichenko)


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

Branch: refs/heads/branch-2.1
Commit: ee654e2182194c8bc3a95ecb2197fb6f505ff4bd
Parents: 7f9b3cf
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Thu Jul 16 21:57:33 2015 +0300
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Thu Jul 16 21:57:33 2015 +0300

----------------------------------------------------------------------
 .../internal/ClusterStackVersionResourceProvider.java   | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ee654e21/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
index 8f50004..972226d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
@@ -62,7 +62,6 @@ import org.apache.ambari.server.orm.dao.ClusterVersionDAO;
 import org.apache.ambari.server.orm.dao.HostVersionDAO;
 import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
 import org.apache.ambari.server.orm.dao.StackDAO;
-import org.apache.ambari.server.orm.entities.ClusterEntity;
 import org.apache.ambari.server.orm.entities.ClusterVersionEntity;
 import org.apache.ambari.server.orm.entities.HostEntity;
 import org.apache.ambari.server.orm.entities.HostVersionEntity;
@@ -79,6 +78,7 @@ import org.apache.ambari.server.state.ServiceInfo;
 import org.apache.ambari.server.state.ServiceOsSpecific;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.utils.StageUtils;
+import org.apache.ambari.server.orm.entities.ClusterEntity;
 
 import com.google.gson.Gson;
 import com.google.inject.Inject;
@@ -535,10 +535,8 @@ public class ClusterStackVersionResourceProvider extends AbstractControllerResou
 
       // First, set desired cluster stack version to enable cross-stack upgrade
       StackId stackId = rve.getStackId();
-      ClusterEntity cluster = clusterDAO.findByName(clName);
-      StackEntity stackEntity = stackDAO.find(stackId.getStackName(), stackId.getStackVersion());
-      cluster.setDesiredStack(stackEntity);
-      clusterDAO.merge(cluster);
+      Cluster cluster = getManagementController().getClusters().getCluster(clName);
+      cluster.setDesiredStackVersion(stackId);
 
       Map<String, String> args = new HashMap<String, String>();
       if (newStateStr.equals(RepositoryVersionState.CURRENT.toString())) {
@@ -555,7 +553,9 @@ public class ClusterStackVersionResourceProvider extends AbstractControllerResou
 
       // Get a host name to populate the hostrolecommand table's hostEntity.
       String defaultHostName = null;
-      List<HostEntity> hosts = new ArrayList(cluster.getHostEntities());
+      // TODO: remove direct access to cluster entity completely
+      ClusterEntity clusterEntity = clusterDAO.findByName(clName);
+      List<HostEntity> hosts = new ArrayList(clusterEntity.getHostEntities());
       if (hosts != null && !hosts.isEmpty()) {
         Collections.sort(hosts);
         defaultHostName = hosts.get(0).getHostName();


Mime
View raw message