peravelli created ATLAS-4899:
--------------------------------

             Summary: POST request to '/api/atlas/v2/types/typedefs' returns 
500 internal server error if a duplicate guid is used
                 Key: ATLAS-4899
                 URL: https://issues.apache.org/jira/browse/ATLAS-4899
             Project: Atlas
          Issue Type: Bug
          Components:  atlas-core, atlas-webui
            Reporter: peravelli
            Assignee: peravelli


If a POST request is made to the endpoint '/api/atlas/v2/types/typedefs' using 
a JSON payload that contains a duplicate GUID value, the response is 500 
Internal server error.
Expected response in such scenarios should be 400 Bad request.

Steps to reproduce :-
1. Make a POST request to the '/api/atlas/v2/types/typedefs' endpoint, using 
the JSON payload attached below, it will create a new typedef.
2. Now, modify the name of the typedef, and make a POST request again. The 
response is 500 Internal server error. If the Atlas application log is checked, 
it shows the following error
{code:java}
2024-08-16 17:23:55,293 INFO  
org.apache.atlas.web.filters.AtlasAuthenticationFilter: [etp57241990-241]: 
Logged into Atlas as = hrt_qa, by proxyUser = null
2024-08-16 17:23:55,293 INFO  
org.apache.atlas.web.filters.AtlasAuthenticationFilter: [etp57241990-241]: 
Request from authenticated user: knox, 
URL=/api/atlas/v2/types/typedefs?doAs=hrt_qa
2024-08-16 17:23:55,309 ERROR org.apache.atlas.GraphTransactionInterceptor: 
[etp57241990-241 - b2423e47-aeca-40e4-b553-21c138363270]: graph rollback due to 
exception 
org.apache.atlas.repository.graphdb.AtlasSchemaViolationException: 
org.janusgraph.core.SchemaViolationException: Adding this property for key 
[__guid] and value [-910550886035] violates a uniqueness constraint [__guid]
    at 
org.apache.atlas.repository.graphdb.janus.AtlasJanusElement.setProperty(AtlasJanusElement.java:151)
 ~[atlas-graphdb-janus-2.1.0.7.2.18.300-30.jar:2.1.0.7.2.18.300-30]
    at 
org.apache.atlas.repository.store.graph.v2.AtlasTypeDefGraphStoreV2.createTypeVertex(AtlasTypeDefGraphStoreV2.java:207)
 ~[atlas-repository-2.1.0.7.2.18.300-30.jar:2.1.0.7.2.18.300-30]
    at 
org.apache.atlas.repository.store.graph.v2.AtlasEntityDefStoreV2.preCreate(AtlasEntityDefStoreV2.java:75)
 ~[atlas-repository-2.1.0.7.2.18.300-30.jar:2.1.0.7.2.18.300-30]
    at 
org.apache.atlas.repository.store.graph.v2.AtlasEntityDefStoreV2.preCreate(AtlasEntityDefStoreV2.java:44)
 ~[atlas-repository-2.1.0.7.2.18.300-30.jar:2.1.0.7.2.18.300-30]
    at 
org.apache.atlas.repository.store.graph.AtlasTypeDefGraphStore.addToGraphStore(AtlasTypeDefGraphStore.java:985)
 ~[atlas-repository-2.1.0.7.2.18.300-30.jar:2.1.0.7.2.18.300-30]
    at 
org.apache.atlas.repository.store.graph.AtlasTypeDefGraphStore.createTypesDef(AtlasTypeDefGraphStore.java:399)
 ~[atlas-repository-2.1.0.7.2.18.300-30.jar:2.1.0.7.2.18.300-30]
    at 
org.apache.atlas.repository.store.graph.AtlasTypeDefGraphStore$$FastClassBySpringCGLIB$$5226c80b.invoke(<generated>)
 ~[atlas-repository-2.1.0.7.2.18.300-30.jar:2.1.0.7.2.18.300-30]
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) 
~[spring-core-5.3.34.jar:5.3.34] {code}
The expected response should have been 400 Bad request.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to