----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/34813/#review85779 -----------------------------------------------------------
Ship it! Looks good. It would probably be a good idea to move the findBy() call out of mergeViewInstance() so that it isn't done in the scopr of the transaction to avoid any issues with the AmbariSessionInterceptor which seems to be broken based on fact that the stack trace you provided is writing to the database as a result of a findBy() invocation even though it is in the scope of a transaciton. - John Speidel On May 29, 2015, 4 p.m., Tom Beerbower wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/34813/ > ----------------------------------------------------------- > > (Updated May 29, 2015, 4 p.m.) > > > Review request for Ambari and John Speidel. > > > Bugs: AMBARI-11540 > https://issues.apache.org/jira/browse/AMBARI-11540 > > > Repository: ambari > > > Description > ------- > > Intermittent BatchUpdateException during create instance of HIVE view. > > Refactored @Transactional method ViewRegistry.installViewInstance() to remove > instanceDAO.findByName() which appears to trigger EntityManagerImpl.flush(). > > > Internal Exception: java.sql.BatchUpdateException: Batch entry 0 INSERT > INTO viewinstanceproperty (name, VALUE, view_name, view_instance_name) VALUES > ('views.tez.instance', NULL, 'HIVE{0.4.0}', 'hiwe2') was aborted. Call > getNextException to see the cause. > Error Code: 0 > Call: INSERT INTO viewinstanceproperty (name, VALUE, view_name, > view_instance_name) VALUES (?, ?, ?, ?) > bind => [4 parameters bound] > at > org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:868) > at > org.eclipse.persistence.internal.jpa.QueryImpl.performPreQueryFlush(QueryImpl.java:963) > at > org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:207) > at > org.eclipse.persistence.internal.jpa.QueryImpl.getSingleResult(QueryImpl.java:517) > at > org.eclipse.persistence.internal.jpa.EJBQueryImpl.getSingleResult(EJBQueryImpl.java:400) > at > org.apache.ambari.server.orm.dao.DaoUtils.selectSingle(DaoUtils.java:71) > at > org.apache.ambari.server.orm.dao.ViewInstanceDAO.findByName(ViewInstanceDAO.java:62) > at > org.apache.ambari.server.orm.AmbariLocalSessionInterceptor.invoke(AmbariLocalSessionInterceptor.java:53) > at > org.apache.ambari.server.view.ViewRegistry.installViewInstance(ViewRegistry.java:528) > > > Diffs > ----- > > ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java > b3ae2d0 > > ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java > c66a9ce > > Diff: https://reviews.apache.org/r/34813/diff/ > > > Testing > ------- > > Manual testing to create view instances. > > Updated unit tests. > > mvn clean test > > all tests pass > > [INFO] > ------------------------------------------------------------------------ > [INFO] BUILD SUCCESS > [INFO] > ------------------------------------------------------------------------ > [INFO] Total time: 47:12 min > [INFO] Finished at: 2015-05-29T11:59:36-04:00 > [INFO] Final Memory: 54M/1374M > [INFO] > ------------------------------------------------------------------------ > > > Thanks, > > Tom Beerbower > >