Jonathan Hurley created AMBARI-17371: ----------------------------------------
Summary: Service deletion throws '500: Server Error' due to foreign key constraint violation Key: AMBARI-17371 URL: https://issues.apache.org/jira/browse/AMBARI-17371 Project: Ambari Issue Type: Bug Components: ambari-server Affects Versions: 2.4.0 Reporter: Jonathan Hurley Assignee: Jonathan Hurley Priority: Blocker Fix For: 2.4.0 # Deploy HDP-2.4.2 cluster with Ambari 2.4.0.0 (secure, non-HA cluster, Ambari DB - MySQL) # Perform Express Upgrade to 2.5.0.0-723 # Try to delete Hive service (after stopping it) {code} 14 Jun 2016 07:30:06,144 INFO [ambari-client-thread-31] ClusterImpl:2217 - Deleting service for cluster, clusterName=cl1, serviceName=HIVE 14 Jun 2016 07:30:06,145 INFO [ambari-client-thread-31] ServiceImpl:610 - Deleting all components for service, clusterName=cl1, serviceName=HIVE 14 Jun 2016 07:30:06,145 INFO [ambari-client-thread-31] ServiceComponentImpl:712 - Deleting all servicecomponenthosts for component, clusterName=cl1, serviceName=HIVE, componentName=HIVE_SERVER, recoveryEnabled=false 14 Jun 2016 07:30:06,146 INFO [ambari-client-thread-31] ServiceComponentImpl:712 - Deleting all servicecomponenthosts for component, clusterName=cl1, serviceName=HIVE, componentName=HIVE_METASTORE, recoveryEnabled=false 14 Jun 2016 07:30:06,146 INFO [ambari-client-thread-31] ServiceComponentImpl:712 - Deleting all servicecomponenthosts for component, clusterName=cl1, serviceName=HIVE, componentName=HIVE_CLIENT, recoveryEnabled=false 14 Jun 2016 07:30:06,190 INFO [ambari-client-thread-31] ServiceComponentImpl:712 - Deleting all servicecomponenthosts for component, clusterName=cl1, serviceName=HIVE, componentName=HCAT, recoveryEnabled=false 14 Jun 2016 07:30:06,215 ERROR [ambari-client-thread-31] AmbariJpaLocalTxnInterceptor:180 - [DETAILED ERROR] Rollback reason: Local Exception Stack: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.2.v20151217-774c696): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`ambaricustom`.`servicecomponent_history`, CONSTRAINT `FK_sc_history_component_id` FOREIGN KEY (`component_id`) REFERENCES `servicecomponentdesiredstate` (`id`)) Error Code: 1451 Call: DELETE FROM servicecomponentdesiredstate WHERE (id = ?) bind => [1 parameter bound] at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:331) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:902) 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.eclipse.persistence.internal.jpa.QueryImpl.performPreQueryFlush(QueryImpl.java:967) at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:207) at org.eclipse.persistence.internal.jpa.QueryImpl.getSingleResult(QueryImpl.java:521) at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getSingleResult(EJBQueryImpl.java:400) at org.apache.ambari.server.orm.dao.HostDAO.findByName(HostDAO.java:60) at org.apache.ambari.server.orm.AmbariLocalSessionInterceptor.invoke(AmbariLocalSessionInterceptor.java:53) at org.apache.ambari.server.orm.dao.HostComponentStateDAO.remove(HostComponentStateDAO.java:180) at org.apache.ambari.server.orm.AmbariJpaLocalTxnInterceptor.invoke(AmbariJpaLocalTxnInterceptor.java:118) at org.apache.ambari.server.state.svccomphost.ServiceComponentHostImpl.removeEntities(ServiceComponentHostImpl.java:1625) {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)