Uploaded image for project: 'Ranger'
  1. Ranger
  2. RANGER-1000

Tag service deletion failure due to MySQLIntegrityConstraintViolationException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.6.0
    • 0.6.0
    • Ranger
    • None

    Description

      Tag service deletion failed with a bad request error in one of the test environments.

      Delete was performed via Ranger Admin UI.
      Request URL:http://localhost:6080/service/plugins/services/51
      Request Method:DELETE
      Status Code:400 Bad Request
      Remote Address:localhost:6080

      Response:
      {"statusCode":1,"msgDesc":"XXService can't be
      deleted","messageList":[

      {"name":"OPER_NOT_ALLOWED_FOR_STATE","rbKey":"xa.error.oper_not_allowed_for_state","message":" Operation not allowed in current state","objectId":51}

      ]}

      Exception trace from xa_portal.log

      2016-05-25 08:57:32,424 [http-bio-6080-exec-32] ERROR org.apache.ranger.service.RangerBaseModelService (RangerBaseModelService.java:277) - Error deleting XXService. Id=51
      javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): 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 (`ranger`.`x_service`, CONSTRAINT `x_service_FK_tag_service` FOREIGN KEY (`tag_service`) REFERENCES `x_service` (`id`))
      Error Code: 1451
      Call: DELETE FROM x_service WHERE ((id = ?) AND (version = ?))
              bind => [2 parameters bound]
      Query: DeleteObjectQuery(XXService [id=51])
              at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:868)
              at sun.reflect.GeneratedMethodAccessor51.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498)
      ......
      Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): 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 (`ranger`.`x_service`, CONSTRAINT `x_service_FK_tag_service` FOREIGN KEY (`tag_service`) REFERENCES `x_service` (`id`))
      Error Code: 1451
      Call: DELETE FROM x_service WHERE ((id = ?) AND (version = ?))
      	bind => [2 parameters bound]
      Query: DeleteObjectQuery(XXService [id=51])
      	at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:331)
      	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:900)
      	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:962)
      .........
      Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`ranger`.`x_service`, CONSTRAINT `x_service_FK_tag_service` FOREIGN KEY (`tag_service`) REFERENCES `x_service` (`id`))
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      .........
      
      

      Attachments

        1. RANGER-1000-4.patch
          2 kB
          Pradeep Agrawal
        2. RANGER-1000-3.patch
          5 kB
          Pradeep Agrawal

        Activity

          People

            pradeep Pradeep Agrawal
            suja suja s
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: