Browse Source

AMBARI-2184. Install progress gets stuck at 33% and displays incorrect status upon refresh. (smohanty)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1485519 13f79535-47bb-0310-9956-ffa450edef68
Sumit Mohanty 12 years ago
parent
commit
af3af9d4e7

+ 3 - 0
CHANGES.txt

@@ -887,6 +887,9 @@ Trunk (unreleased changes):
 
 
  BUG FIXES
  BUG FIXES
 
 
+ AMBARI-2184. Install progress gets stuck at 33% and displays incorrect
+ status upon refresh. (smohanty)
+
  AMBARI-2159. After upgrading ambari from 1.2.2.5 to 1.2.3.6 the server
  AMBARI-2159. After upgrading ambari from 1.2.2.5 to 1.2.3.6 the server
  throws 500 error when starting/stopping any service. (smohanty)
  throws 500 error when starting/stopping any service. (smohanty)
 
 

+ 5 - 0
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentConfigMappingDAO.java

@@ -38,6 +38,11 @@ public class HostComponentConfigMappingDAO {
   @Inject
   @Inject
   DaoUtils daoUtils;
   DaoUtils daoUtils;
 
 
+  @Transactional
+  public void create(HostComponentConfigMappingEntity entity) {
+    entityManagerProvider.get().persist(entity);
+  }
+
   @Transactional
   @Transactional
   public List<HostComponentConfigMappingEntity> findByType(
   public List<HostComponentConfigMappingEntity> findByType(
       Collection<String> configTypes) {
       Collection<String> configTypes) {

+ 5 - 0
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentDesiredConfigMappingDAO.java

@@ -38,6 +38,11 @@ public class HostComponentDesiredConfigMappingDAO {
   @Inject
   @Inject
   DaoUtils daoUtils;
   DaoUtils daoUtils;
 
 
+  @Transactional
+  public void create(HostComponentDesiredConfigMappingEntity entity) {
+    entityManagerProvider.get().persist(entity);
+  }
+
   @Transactional
   @Transactional
   public List<HostComponentDesiredConfigMappingEntity> findByType(
   public List<HostComponentDesiredConfigMappingEntity> findByType(
       Collection<String> configTypes) {
       Collection<String> configTypes) {

+ 1 - 1
ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java

@@ -66,7 +66,7 @@ public class HostComponentDesiredStateEntity {
   @JoinColumn(name = "host_name", referencedColumnName = "host_name", nullable = false)
   @JoinColumn(name = "host_name", referencedColumnName = "host_name", nullable = false)
   private HostEntity hostEntity;
   private HostEntity hostEntity;
 
 
-  @OneToMany(mappedBy = "hostComponentDesiredStateEntity", cascade = CascadeType.ALL)
+  @OneToMany(mappedBy = "hostComponentDesiredStateEntity", cascade = {CascadeType.REMOVE, CascadeType.REFRESH})
   private Collection<HostComponentDesiredConfigMappingEntity> desiredConfigMappingEntities;
   private Collection<HostComponentDesiredConfigMappingEntity> desiredConfigMappingEntities;
 
 
   public Long getClusterId() {
   public Long getClusterId() {

+ 1 - 1
ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java

@@ -66,7 +66,7 @@ public class HostComponentStateEntity {
   @JoinColumn(name = "host_name", referencedColumnName = "host_name", nullable = false)
   @JoinColumn(name = "host_name", referencedColumnName = "host_name", nullable = false)
   private HostEntity hostEntity;
   private HostEntity hostEntity;
 
 
-  @OneToMany(mappedBy = "hostComponentStateEntity", cascade = CascadeType.ALL)
+  @OneToMany(mappedBy = "hostComponentStateEntity", cascade = {CascadeType.REMOVE, CascadeType.REFRESH})
   private Collection<HostComponentConfigMappingEntity> configMappingEntities;
   private Collection<HostComponentConfigMappingEntity> configMappingEntities;
 
 
   public Long getClusterId() {
   public Long getClusterId() {

+ 4 - 1
ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java

@@ -908,6 +908,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
             contains = true;
             contains = true;
             mappingEntity.setVersionTag(entry.getValue());
             mappingEntity.setVersionTag(entry.getValue());
             mappingEntity.setTimestamp(now);
             mappingEntity.setTimestamp(now);
+            hostComponentConfigMappingDAO.merge(mappingEntity);
             break;
             break;
           }
           }
         }
         }
@@ -934,7 +935,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
           }
           }
           stateEntity.getHostComponentConfigMappingEntities().add(newEntity);
           stateEntity.getHostComponentConfigMappingEntities().add(newEntity);
           newEntity.setHostComponentStateEntity(stateEntity);
           newEntity.setHostComponentStateEntity(stateEntity);
-
+          hostComponentConfigMappingDAO.create(newEntity);
         }
         }
       }
       }
 
 
@@ -1077,6 +1078,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
             contains = true;
             contains = true;
             desiredConfigMappingEntity.setVersionTag(entry.getValue().getVersionTag());
             desiredConfigMappingEntity.setVersionTag(entry.getValue().getVersionTag());
             desiredConfigMappingEntity.setTimestamp(new Date().getTime());
             desiredConfigMappingEntity.setTimestamp(new Date().getTime());
+            hostComponentDesiredConfigMappingDAO.merge(desiredConfigMappingEntity);
             break;
             break;
           }
           }
         }
         }
@@ -1092,6 +1094,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
           newEntity.setTimestamp(new Date().getTime());
           newEntity.setTimestamp(new Date().getTime());
           newEntity.setHostComponentDesiredStateEntity(desiredStateEntity);
           newEntity.setHostComponentDesiredStateEntity(desiredStateEntity);
           desiredStateEntity.getHostComponentDesiredConfigMappingEntities().add(newEntity);
           desiredStateEntity.getHostComponentDesiredConfigMappingEntities().add(newEntity);
+          hostComponentDesiredConfigMappingDAO.create(newEntity);
         }
         }
 
 
         this.desiredConfigs.put(entry.getKey(), entry.getValue().getVersionTag());
         this.desiredConfigs.put(entry.getKey(), entry.getValue().getVersionTag());