This is an automated email from the ASF dual-hosted git repository.
madhan pushed a commit to branch branch-1.0
in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/branch-1.0 by this push:
new 400af88 ATLAS-3297: cache added/update entities in request-context,
for use in entity-change listeners
400af88 is described below
commit 400af8883ab3c76b3ff870eff8e371545fd9425f
Author: Madhan Neethiraj <[email protected]>
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 31b20ff..4cdb8fa 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);
}
}