You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2019/06/24 03:56:43 UTC

[atlas] branch branch-2.0 updated: ATLAS-3297: cache added/update entities in request-context, for use in entity-change listeners

This is an automated email from the ASF dual-hosted git repository.

madhan pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new afb67db  ATLAS-3297: cache added/update entities in request-context, for use in entity-change listeners
afb67db is described below

commit afb67db73038c33e45f398edf2a38e1b5f6e2268
Author: Madhan Neethiraj <ma...@apache.org>
AuthorDate: Fri Jun 21 14:37:27 2019 -0700

    ATLAS-3297: cache added/update entities in request-context, for use in entity-change listeners
    
    (cherry picked from commit 1d2aad52f1053ac03edad78f9568d62010617a97)
---
 .../atlas/repository/store/graph/v2/EntityGraphMapper.java       | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java
index 4f93c8f..5f0aa15 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java
@@ -213,7 +213,8 @@ public class EntityGraphMapper {
     public EntityMutationResponse mapAttributesAndClassifications(EntityMutationContext context, final boolean isPartialUpdate, final boolean replaceClassifications) throws AtlasBaseException {
         MetricRecorder metric = RequestContext.get().startMetricRecord("mapAttributesAndClassifications");
 
-        EntityMutationResponse resp = new EntityMutationResponse();
+        EntityMutationResponse resp       = new EntityMutationResponse();
+        RequestContext         reqContext = RequestContext.get();
 
         Collection<AtlasEntity> createdEntities = context.getCreatedEntities();
         Collection<AtlasEntity> updatedEntities = context.getUpdatedEntities();
@@ -230,6 +231,8 @@ public class EntityGraphMapper {
 
                 resp.addEntity(CREATE, constructHeader(createdEntity, entityType, vertex));
                 addClassifications(context, guid, createdEntity.getClassifications());
+
+                reqContext.cache(createdEntity);
             }
         }
 
@@ -249,10 +252,12 @@ public class EntityGraphMapper {
                     resp.addEntity(UPDATE, constructHeader(updatedEntity, entityType, vertex));
                 }
 
-                if ( replaceClassifications ) {
+                if (replaceClassifications) {
                     deleteClassifications(guid);
                     addClassifications(context, guid, updatedEntity.getClassifications());
                 }
+
+                reqContext.cache(updatedEntity);
             }
         }