Uploaded image for project: 'Ambari'
  1. Ambari
  2. AMBARI-17371

Unable To Delete A Service After Upgrade Due To Foreign Key Violation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 2.4.0
    • 2.4.0
    • ambari-server
    • None

    Description

      1. Deploy HDP-2.4.2 cluster with Ambari 2.4.0.0 (secure, non-HA cluster, Ambari DB - MySQL)
      2. Perform Express Upgrade to 2.5.0.0-723
      3. Try to delete Hive service (after stopping it)
      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)
      

      Attachments

        1. AMBARI-17371.patch
          9 kB
          Jonathan Hurley

        Issue Links

          Activity

            People

              jonathanhurley Jonathan Hurley
              jonathanhurley Jonathan Hurley
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: