> On Nov. 5, 2015, 8:29 p.m., Sid Wagle wrote:
> > ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java,
> >  line 1961
> > <https://reviews.apache.org/r/39977/diff/1/?file=1116749#file1116749line1961>
> >
> >     What about serviceComponentHostsByHost, this map will still cache stale 
> > data with a cahced refernce to dettached entity.
> >     
> >     The root cause of re-appearing data is the cached entity refrences !
> >     
> >     The other evil is Cascade + manual operations mix. This defientely 
> > solves one of the problem areas.

The serviceComponentHostsByHost  is already handled by the 
deleteService(Service service) method. See 
for (List<ServiceComponentHost> serviceComponents: 
serviceComponentHostsByHost.values()){
      Iterables.removeIf(serviceComponents, new 
Predicate<ServiceComponentHost>() {
        @Override
        public boolean apply(ServiceComponentHost serviceComponentHost) {
          return serviceComponentHost.getServiceName().equals(serviceName);
        }
      });


- Sebastian


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/39977/#review105292
-----------------------------------------------------------


On Nov. 5, 2015, 6:27 p.m., Sebastian Toader wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/39977/
> -----------------------------------------------------------
> 
> (Updated Nov. 5, 2015, 6:27 p.m.)
> 
> 
> Review request for Ambari, Jonathan Hurley, Robert Levas, Sumit Mohanty, and 
> Sid Wagle.
> 
> 
> Bugs: AMBARI-13741
>     https://issues.apache.org/jira/browse/AMBARI-13741
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Deleting a service from existing cluster using REST API 
> (https://cwiki.apache.org/confluence/display/AMBARI/Using+APIs+to+delete+a+service+or+all+host+components+on+a+host)
>  fails with the below error:
> 
> Call: DELETE FROM clusterservice Where ((cluster_id = ?) AND (service_name = 
> ?))
> Caused by: ... ORA-02292 integrity constraint violated - child record found
> 
> 
> Diffs
> -----
> 
>   
> ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterServiceEntity.java
>  d34e2d5 
>   
> ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java
>  4195710 
>   
> ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
>  898aa33 
>   
> ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
>  c0804ff 
>   
> ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterImplTest.java
>  39431ed 
> 
> Diff: https://reviews.apache.org/r/39977/diff/
> 
> 
> Testing
> -------
> 
> Manual testing:
> 
> 1. Created a simple 3 node cluster uzing the wizzard
> 2. Deleted a service using REST API
> 3. Verified that affected records were deleted from the following tables: 
> clusterservices, servicedesiredstate, servicecomponentdesiredstate, 
> hostcomponentstate, hostcomponentdesiredstate
> 4. Refresh UI than re-add the deleted service.
> 
>  
> Unit tests:
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time: 1:11:05.677s
> [INFO] Finished at: Thu Nov 05 17:02:51 CET 2015
> [INFO] Final Memory: 32M/763M
> [INFO] 
> ------------------------------------------------------------------------
> 
> 
> Thanks,
> 
> Sebastian Toader
> 
>

Reply via email to