Re: Review Request 39977: API call to delete service fails with error: integrity constraint violated - child record found

2015-11-06 Thread Sid Wagle

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

Ship it!


Ship It!

- Sid Wagle


On Nov. 6, 2015, 9:55 a.m., Sebastian Toader wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/39977/
> ---
> 
> (Updated Nov. 6, 2015, 9:55 a.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
> 
>



Re: Review Request 39977: API call to delete service fails with error: integrity constraint violated - child record found

2015-11-06 Thread Alejandro Fernandez

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

Ship it!


Ship It!

- Alejandro Fernandez


On Nov. 6, 2015, 9:55 a.m., Sebastian Toader wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/39977/
> ---
> 
> (Updated Nov. 6, 2015, 9:55 a.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
> 
>



Re: Review Request 39977: API call to delete service fails with error: integrity constraint violated - child record found

2015-11-06 Thread Sebastian Toader

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

(Updated Nov. 6, 2015, 10:55 a.m.)


Review request for Ambari, Jonathan Hurley, Robert Levas, Sumit Mohanty, and 
Sid Wagle.


Changes
---

New version with fixes uploaded


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 (updated)
-

  
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



Re: Review Request 39977: API call to delete service fails with error: integrity constraint violated - child record found

2015-11-06 Thread Sebastian Toader


> 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
> > 
> >
> > 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 serviceComponents: 
serviceComponentHostsByHost.values()){
  Iterables.removeIf(serviceComponents, new 
Predicate() {
@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
> 
>



Re: Review Request 39977: API call to delete service fails with error: integrity constraint violated - child record found

2015-11-05 Thread Sid Wagle

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



ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
 (line 1955)


Please document that this need to be called only with write lock acquired.



ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
 (line 1960)


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.


- Sid Wagle


On Nov. 5, 2015, 5: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, 5: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
> 
>



Re: Review Request 39977: API call to delete service fails with error: integrity constraint violated - child record found

2015-11-05 Thread Alejandro Fernandez

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

Ship it!


Ship It!

- Alejandro Fernandez


On Nov. 5, 2015, 4:11 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, 4:11 p.m.)
> 
> 
> Review request for Ambari, Jonathan Hurley and Robert Levas.
> 
> 
> 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
> 
>



Re: Review Request 39977: API call to delete service fails with error: integrity constraint violated - child record found

2015-11-05 Thread Robert Levas

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

Ship it!


Ship It!


ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
 (line 1955)


Can this be JavaDoc-ed so we know why this method was added?


- Robert Levas


On Nov. 5, 2015, 11:11 a.m., Sebastian Toader wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/39977/
> ---
> 
> (Updated Nov. 5, 2015, 11:11 a.m.)
> 
> 
> Review request for Ambari, Jonathan Hurley and Robert Levas.
> 
> 
> 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
> 
>



Review Request 39977: API call to delete service fails with error: integrity constraint violated - child record found

2015-11-05 Thread Sebastian Toader

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

Review request for Ambari, Jonathan Hurley and Robert Levas.


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