----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/49093/#review139074 -----------------------------------------------------------
Ship it! Ship It! - Robert Levas On June 22, 2016, 11:35 a.m., Jonathan Hurley wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/49093/ > ----------------------------------------------------------- > > (Updated June 22, 2016, 11:35 a.m.) > > > Review request for Ambari, Alejandro Fernandez and Robert Levas. > > > Bugs: AMBARI-17371 > https://issues.apache.org/jira/browse/AMBARI-17371 > > > Repository: ambari > > > Description > ------- > > When deleting a service after an upgrade there is a foreign key violation. > This is due to how JPA is caching the collections when creating the > bi-directional association. > > ``` > Exception [EclipseLink-4002] (Eclipse Persistence Services - > 2.6.2.v20151217-774c696): org.eclipse.persistence.exceptions.DatabaseException > Internal Exception: org.postgresql.util.PSQLException: ERROR: update or > delete on table "servicecomponentdesiredstate" violates foreign key > constraint "fk_sc_history_component_id" on table "servicecomponent_history" > Detail: Key (id)=(1) is still referenced from table > "servicecomponent_history". > Error Code: 0 > Call: DELETE FROM servicecomponentdesiredstate WHERE (id = ?) > bind => [1 parameter bound] > at > org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:340) > at > org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.processExceptionForCommError(DatabaseAccessor.java:1620) > at > org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:900) > at > org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:964) > at > org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:633) > at > org.eclipse.persistence.internal.databaseaccess.ParameterizedSQLBatchWritingMechanism.executeBatch(ParameterizedSQLBatchWritingMechanism.java:149) > at > org.eclipse.persistence.internal.databaseaccess.ParameterizedSQLBatchWritingMechanism.executeBatchedStatements(ParameterizedSQLBatchWritingMechanism.java:134) > at > org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.writesCompleted(DatabaseAccessor.java:1845) > at > org.eclipse.persistence.internal.sessions.AbstractSession.writesCompleted(AbstractSession.java:4300) > at > org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.writesCompleted(UnitOfWorkImpl.java:5592) > at > org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.writeChanges(RepeatableWriteUnitOfWork.java:456) > at > org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:874) > at > org.apache.ambari.server.orm.dao.ServiceComponentDesiredStateDAO.remove(ServiceComponentDesiredStateDAO.java:121) > ``` > > > Diffs > ----- > > > ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java > 7281c01 > > ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentHistoryEntity.java > e7fef71 > > ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java > 9088c1c > > ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java > 6b00616 > > Diff: https://reviews.apache.org/r/49093/diff/ > > > Testing > ------- > > mvn clean test > > > Thanks, > > Jonathan Hurley > >