atlas-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ayub Pathan (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ATLAS-1743) Issue with uniqueAttribute while creation of entities
Date Fri, 21 Apr 2017 10:59:04 GMT

    [ https://issues.apache.org/jira/browse/ATLAS-1743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15978511#comment-15978511
] 

Ayub Pathan commented on ATLAS-1743:
------------------------------------

I believe this is working as designed. Uniqueness of an asset is identified through qualified
name or GUID. Atlas actually checks for the existence of the asset by looking at its qualifiedName/GUID
in the backend store and if it exists, the existing entity would be updated and if doesn't
then it is created.

The REST API to create an asset acts an UPDATE when the assets already exists in atlas and
CREATE when it doesn't.

https://github.com/apache/incubator-atlas/blob/0.8-incubating/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java#L153
{code:java}
    /**
     * Create new entity or update existing entity in Atlas.
     * Existing entity is matched using its unique guid if supplied or by its unique attributes
eg: qualifiedName
     * @param entity
     * @return EntityMutationResponse
     * @throws AtlasBaseException
     */
    @POST
    @Consumes(Servlets.JSON_MEDIA_TYPE)
    @Produces(Servlets.JSON_MEDIA_TYPE)
    public EntityMutationResponse createOrUpdate(AtlasEntityWithExtInfo entity) throws AtlasBaseException
{
        AtlasPerfTracer perf = null;

        try {
            if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
                perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityREST.createOrUpdate()");
            }

            return entitiesStore.createOrUpdate(new AtlasEntityStream(entity), false);
        } finally {
            AtlasPerfTracer.log(perf);
        }
    }
{code}

> Issue with uniqueAttribute while creation of entities
> -----------------------------------------------------
>
>                 Key: ATLAS-1743
>                 URL: https://issues.apache.org/jira/browse/ATLAS-1743
>             Project: Atlas
>          Issue Type: Bug
>          Components:  atlas-core
>    Affects Versions: 0.8-incubating, 0.9-incubating
>            Reporter: Sharmadha Sainath
>
> Atlas allows creation of entities with same value for unique attributes.
> For example ,
> 1. Created an hdfs_path entity with 
> * name = dir1
> * qualifiedName = "userdir@cl1" 
> * path = /user/user1/dir
> Entity is created successfully.
> 2. Created another hdfs_path entity  with
> * name = dir2
> * qualifiedName = "userdir@cl1" 
> * path = /user/user2/dir
> Qualified Name is uniqueAttribute and entity creation with same Qualified Name is allowed.
> Problem is when the 2nd hdfs_path entity is created , 1st entity is updated with 2nd
entity's values , hence 2nd entity creation is merely an update call here instead of a create
call because of same unique attribute.
> There is no condition to check uniqueness of attributes while creation of entities which
is causing the problem.
> If 1st hdfs_path entity is DELETED , then 2nd hdfs_path entity POST call creates new
entity.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message