Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D979D200C4E for ; Fri, 21 Apr 2017 12:59:10 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D650B160BA2; Fri, 21 Apr 2017 10:59:10 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 28ED2160B97 for ; Fri, 21 Apr 2017 12:59:10 +0200 (CEST) Received: (qmail 55583 invoked by uid 500); 21 Apr 2017 10:59:09 -0000 Mailing-List: contact dev-help@atlas.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@atlas.incubator.apache.org Delivered-To: mailing list dev@atlas.incubator.apache.org Received: (qmail 55572 invoked by uid 99); 21 Apr 2017 10:59:09 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Apr 2017 10:59:09 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id D225118002C for ; Fri, 21 Apr 2017 10:59:08 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.001 X-Spam-Level: X-Spam-Status: No, score=-100.001 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id Tp5UyH_b2uUv for ; Fri, 21 Apr 2017 10:59:06 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 84A465FDDC for ; Fri, 21 Apr 2017 10:59:05 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id CECDDE0D64 for ; Fri, 21 Apr 2017 10:59:04 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 26C6921B58 for ; Fri, 21 Apr 2017 10:59:04 +0000 (UTC) Date: Fri, 21 Apr 2017 10:59:04 +0000 (UTC) From: "Ayub Pathan (JIRA)" To: dev@atlas.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (ATLAS-1743) Issue with uniqueAttribute while creation of entities MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 21 Apr 2017 10:59:11 -0000 [ 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)