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

Ship it!


Ship It!

- Nate Cole


On May 23, 2014, 12:08 p.m., Tom Beerbower wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/21867/
> -----------------------------------------------------------
> 
> (Updated May 23, 2014, 12:08 p.m.)
> 
> 
> Review request for Ambari, John Speidel, Nate Cole, and Sid Wagle.
> 
> 
> Bugs: AMBARI-5871
>     https://issues.apache.org/jira/browse/AMBARI-5871
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> After setting up sevaral instances and restart ambari after every creating 
> instance, I'm starting to get this error:
> {noformat}
> The attribute [view] of class 
> [org.apache.ambari.server.orm.entities.ViewInstanceEntity] is mapped to a 
> primary key column in the database. Updates are not allowed.
> {noformat}
> In logs after restarting server
> 
> Setting up one view, e.g. FILES (put jar to resources, restart ambari, create 
> instance through API, again restart) is ok.
> Then, if I want to install one another ambari view (e.g. PIG) I'm getting 
> error on creating instance (POST request to 
> /api/v1/views/PIG/versions/0.1.0/instances/PIG_1 returns 500). In logs I see 
> this
> 
> {noformat}
> javax.persistence.RollbackException: java.lang.IllegalStateException: During 
> synchronization a new object was found through a relationship that was not 
> marked cascade PERSIST: 
> org.apache.ambari.server.orm.entities.ViewEntity@2260898b.
>         at 
> org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:102)
>         at 
> org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:63)
>         at 
> org.apache.ambari.server.orm.AmbariJpaLocalTxnInterceptor.invoke(AmbariJpaLocalTxnInterceptor.java:91)
>         at 
> org.apache.ambari.server.view.ViewRegistry.installViewInstance(ViewRegistry.java:351)
>         at 
> org.apache.ambari.server.controller.internal.ViewInstanceResourceProvider$1.invoke(ViewInstanceResourceProvider.java:289)
>         at 
> org.apache.ambari.server.controller.internal.ViewInstanceResourceProvider$1.invoke(ViewInstanceResourceProvider.java:286)
>         at 
> org.apache.ambari.server.controller.internal.AbstractResourceProvider.createResources(AbstractResourceProvider.java:237)
>         at 
> org.apache.ambari.server.controller.internal.ViewInstanceResourceProvider.createResources(ViewInstanceResourceProvider.java:107)
>         at 
> org.apache.ambari.server.controller.internal.ClusterControllerImpl.createResources(ClusterControllerImpl.java:218)
>         at 
> org.apache.ambari.server.api.services.persistence.PersistenceManagerImpl.create(PersistenceManagerImpl.java:75)
> ...
> {noformat}
> 
> I'm not getting error if I install FILES and PIG in one shot (create both 
> instances without restarting ambari after each one)
> 
> Steps to reproduce ...
> 
> 1) download files.jar
> 2) restart ambari
> 3) create instance for FILES
> 4) restart ambari (and ensure that all works)
> 5) download pig.jar
> 6) restart ambari
> 7) create instance for PIG (got error here)
> 
> The problem is that deployment of the views are not isolated from each other. 
> So the code reads the archives and builds up the registry for all of the 
> views, then it persists any views that aren't already persisted, then it 
> deploys them all to the Jetty container. There is a situation where all the 
> view archives get read followed by a failure trying to persist one of the 
> views view. The failure causes the whole process of view deployment to stop 
> so none of the views get deployed to Jetty.
> 
> Inn this scenario, even though a view doesn't get persisted, it is in the 
> view registry which means that it shows up in the API. This means that the 
> user can invoke the API to create an instance but it fails because the view 
> is only partially deployed (not in the DB).
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java 
> 3b16cca 
>   
> ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java
>  2a83abe 
> 
> Diff: https://reviews.apache.org/r/21867/diff/
> 
> 
> Testing
> -------
> 
> Added new unit test. All tests pass ...
> 
> Results :
> 
> Tests run: 1623, Failures: 0, Errors: 0, Skipped: 13
> 
> 
> ...
> 
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time: 23:38.693s
> [INFO] Finished at: Fri May 23 11:53:09 EDT 2014
> [INFO] Final Memory: 36M/123M
> [INFO] 
> ------------------------------------------------------------------------
> 
> 
> Thanks,
> 
> Tom Beerbower
> 
>

Reply via email to