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

Review request for Ambari, Nate Cole and Sid Wagle.


Bugs: AMBARI-6019
    https://issues.apache.org/jira/browse/AMBARI-6019


Repository: ambari


Description
-------

Get the following exception if views are deployed, then restart with new view 
in views folder. The new view fails to deploy with the following ...

javax.persistence.RollbackException: Exception EclipseLink-7251 (Eclipse 
Persistence Services - 2.4.0.v20120608-): 
org.eclipse.persistence.exceptions.ValidationException
Exception Description: 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.

The exception only happens if a new instance of one of the initial views is 
created through the REST API before the server is restarted and the new view 
deployed.

It turns out that there is an issue when the views are being setup in the 
registry.  Any instance that is not present in the archive but exists in the 
Ambari db is bound to the registry view and added to the registry.  The problem 
is that the instance being added to the registry is still bound to the entity 
manager.  Since the registry view is a different instance of a ViewEntity, JPA 
complains because you can't change the PK of the instance.

The strange part is that the exception is not reported right away.  Instead it 
gets thrown on the commit from the AmbariJpaLocalTxnInterceptor when a totally 
different view is being created in the db. 


Diffs
-----

  ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java 
b1c0f4c 
  
ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java 
a980696 

Diff: https://reviews.apache.org/r/22228/diff/


Testing
-------

All unit tests pass ...

Results :

Tests run: 1651, Failures: 0, Errors: 0, Skipped: 13
…

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22:15.696s
[INFO] Finished at: Wed Jun 04 09:08:29 EDT 2014
[INFO] Final Memory: 36M/123M
[INFO] ------------------------------------------------------------------------


Thanks,

Tom Beerbower

Reply via email to