Author: smohanty
Date: Thu May 23 00:29:09 2013
New Revision: 1485519

URL: http://svn.apache.org/r1485519
Log:
AMBARI-2184. Install progress gets stuck at 33% and displays incorrect status 
upon refresh. (smohanty)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentConfigMappingDAO.java
    
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentDesiredConfigMappingDAO.java
    
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java
    
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java
    
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java

Modified: incubator/ambari/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1485519&r1=1485518&r2=1485519&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Thu May 23 00:29:09 2013
@@ -887,6 +887,9 @@ Trunk (unreleased changes):
 
  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
  throws 500 error when starting/stopping any service. (smohanty)
 

Modified: 
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentConfigMappingDAO.java
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentConfigMappingDAO.java?rev=1485519&r1=1485518&r2=1485519&view=diff
==============================================================================
--- 
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentConfigMappingDAO.java
 (original)
+++ 
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentConfigMappingDAO.java
 Thu May 23 00:29:09 2013
@@ -39,6 +39,11 @@ public class HostComponentConfigMappingD
   DaoUtils daoUtils;
 
   @Transactional
+  public void create(HostComponentConfigMappingEntity entity) {
+    entityManagerProvider.get().persist(entity);
+  }
+
+  @Transactional
   public List<HostComponentConfigMappingEntity> findByType(
       Collection<String> configTypes) {
     TypedQuery<HostComponentConfigMappingEntity> query =

Modified: 
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentDesiredConfigMappingDAO.java
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentDesiredConfigMappingDAO.java?rev=1485519&r1=1485518&r2=1485519&view=diff
==============================================================================
--- 
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentDesiredConfigMappingDAO.java
 (original)
+++ 
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentDesiredConfigMappingDAO.java
 Thu May 23 00:29:09 2013
@@ -39,6 +39,11 @@ public class HostComponentDesiredConfigM
   DaoUtils daoUtils;
 
   @Transactional
+  public void create(HostComponentDesiredConfigMappingEntity entity) {
+    entityManagerProvider.get().persist(entity);
+  }
+
+  @Transactional
   public List<HostComponentDesiredConfigMappingEntity> findByType(
       Collection<String> configTypes) {
     TypedQuery<HostComponentDesiredConfigMappingEntity> query =

Modified: 
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java?rev=1485519&r1=1485518&r2=1485519&view=diff
==============================================================================
--- 
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java
 (original)
+++ 
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java
 Thu May 23 00:29:09 2013
@@ -66,7 +66,7 @@ public class HostComponentDesiredStateEn
   @JoinColumn(name = "host_name", referencedColumnName = "host_name", nullable 
= false)
   private HostEntity hostEntity;
 
-  @OneToMany(mappedBy = "hostComponentDesiredStateEntity", cascade = 
CascadeType.ALL)
+  @OneToMany(mappedBy = "hostComponentDesiredStateEntity", cascade = 
{CascadeType.REMOVE, CascadeType.REFRESH})
   private Collection<HostComponentDesiredConfigMappingEntity> 
desiredConfigMappingEntities;
 
   public Long getClusterId() {

Modified: 
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java?rev=1485519&r1=1485518&r2=1485519&view=diff
==============================================================================
--- 
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java
 (original)
+++ 
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java
 Thu May 23 00:29:09 2013
@@ -66,7 +66,7 @@ public class HostComponentStateEntity {
   @JoinColumn(name = "host_name", referencedColumnName = "host_name", nullable 
= false)
   private HostEntity hostEntity;
 
-  @OneToMany(mappedBy = "hostComponentStateEntity", cascade = CascadeType.ALL)
+  @OneToMany(mappedBy = "hostComponentStateEntity", cascade = 
{CascadeType.REMOVE, CascadeType.REFRESH})
   private Collection<HostComponentConfigMappingEntity> configMappingEntities;
 
   public Long getClusterId() {

Modified: 
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java?rev=1485519&r1=1485518&r2=1485519&view=diff
==============================================================================
--- 
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
 (original)
+++ 
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
 Thu May 23 00:29:09 2013
@@ -908,6 +908,7 @@ public class ServiceComponentHostImpl im
             contains = true;
             mappingEntity.setVersionTag(entry.getValue());
             mappingEntity.setTimestamp(now);
+            hostComponentConfigMappingDAO.merge(mappingEntity);
             break;
           }
         }
@@ -934,7 +935,7 @@ public class ServiceComponentHostImpl im
           }
           stateEntity.getHostComponentConfigMappingEntities().add(newEntity);
           newEntity.setHostComponentStateEntity(stateEntity);
-
+          hostComponentConfigMappingDAO.create(newEntity);
         }
       }
 
@@ -1077,6 +1078,7 @@ public class ServiceComponentHostImpl im
             contains = true;
             
desiredConfigMappingEntity.setVersionTag(entry.getValue().getVersionTag());
             desiredConfigMappingEntity.setTimestamp(new Date().getTime());
+            
hostComponentDesiredConfigMappingDAO.merge(desiredConfigMappingEntity);
             break;
           }
         }
@@ -1092,6 +1094,7 @@ public class ServiceComponentHostImpl im
           newEntity.setTimestamp(new Date().getTime());
           newEntity.setHostComponentDesiredStateEntity(desiredStateEntity);
           
desiredStateEntity.getHostComponentDesiredConfigMappingEntities().add(newEntity);
+          hostComponentDesiredConfigMappingDAO.create(newEntity);
         }
 
         this.desiredConfigs.put(entry.getKey(), 
entry.getValue().getVersionTag());


Reply via email to