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":[
]}
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) .........