Mehul Parikh created RANGER-2764:
------------------------------------
Summary: Role API : Duplicate key value violates unique constraint
"x_ranger_global_state_uk_state_name"
Key: RANGER-2764
URL: https://issues.apache.org/jira/browse/RANGER-2764
Project: Ranger
Issue Type: Improvement
Components: Ranger
Reporter: Mehul Parikh
Assignee: Mahesh Hanumant Bandal
When Role creation is tried in multiple thread, it fails with exception for
duplicate key constraint :
{code:java}
2020-03-12 14:33:26,670 ERROR org.apache.ranger.rest.RoleREST:
createRole({name=dummy_role1, description=dummy role1 - Cluster1, options={},
users=[], groups=[{hive, false}, {roleAdmin, false}], roles=[],
createdByUser=null}) failed
javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse
Persistence Services - 2.5.2.v20140319-9ad6abd):
org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: duplicate key
value violates unique constraint "x_ranger_global_state_uk_state_name"
Detail: Key (state_name)=(RangerRole) already exists.
Error Code: 0
Call: INSERT INTO x_ranger_global_state (id, ADDED_BY_ID, app_data,
CREATE_TIME, state_name, UPDATE_TIME, UPD_BY_ID, version) VALUES (?, ?, ?, ?,
?, ?, ?, ?)
bind => [8 parameters bound]
at
org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:868)
at sun.reflect.GeneratedMethodAccessor79.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)