Repository: atlas Updated Branches: refs/heads/master 4582d4a45 -> ad4db42ef
ATLAS-2434: Performance improvement for import operation. Signed-off-by: Madhan Neethiraj <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/ad4db42e Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/ad4db42e Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/ad4db42e Branch: refs/heads/master Commit: ad4db42ef409d4283741906e22b657bab59f3d58 Parents: 4582d4a Author: Ashutosh Mestry <[email protected]> Authored: Wed Feb 7 13:02:31 2018 -0800 Committer: Madhan Neethiraj <[email protected]> Committed: Wed Feb 7 20:57:48 2018 -0800 ---------------------------------------------------------------------- .../apache/atlas/repository/store/graph/v1/AtlasGraphUtilsV1.java | 3 ++- .../apache/atlas/repository/store/graph/v1/BulkImporterImpl.java | 3 +++ .../apache/atlas/repository/store/graph/v1/EntityGraphMapper.java | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/atlas/blob/ad4db42e/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasGraphUtilsV1.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasGraphUtilsV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasGraphUtilsV1.java index fdc6024..13ee2a6 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasGraphUtilsV1.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasGraphUtilsV1.java @@ -253,7 +253,8 @@ public class AtlasGraphUtilsV1 { } else { vertex = AtlasGraphUtilsV1.findByTypeAndPropertyName(entityType.getTypeName(), attribute.getVertexPropertyName(), attrValue); - if (vertex == null) { + // if no instance of given typeName is found, try to find an instance of type's sub-type + if (vertex == null && !entityType.getAllSubTypes().isEmpty()) { vertex = AtlasGraphUtilsV1.findBySuperTypeAndPropertyName(entityType.getTypeName(), attribute.getVertexPropertyName(), attrValue); } } http://git-wip-us.apache.org/repos/asf/atlas/blob/ad4db42e/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/BulkImporterImpl.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/BulkImporterImpl.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/BulkImporterImpl.java index 467ced7..af31095 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/BulkImporterImpl.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/BulkImporterImpl.java @@ -19,6 +19,7 @@ package org.apache.atlas.repository.store.graph.v1; import com.google.common.annotations.VisibleForTesting; import org.apache.atlas.AtlasErrorCode; +import org.apache.atlas.RequestContextV1; import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.model.impexp.AtlasImportResult; import org.apache.atlas.model.instance.AtlasEntity; @@ -98,6 +99,8 @@ public class BulkImporterImpl implements BulkImporter { if (!updateResidualList(abe, residualList, entityWithExtInfo.getEntity().getGuid())) { throw abe; } + } finally { + RequestContextV1.clear(); } } http://git-wip-us.apache.org/repos/asf/atlas/blob/ad4db42e/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java index b961e20..c203ff4 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphMapper.java @@ -1463,7 +1463,7 @@ public class EntityGraphMapper { AtlasObjectId objectId = new AtlasObjectId(GraphHelper.getGuid(vertex), GraphHelper.getTypeName(vertex)); RequestContextV1 req = RequestContextV1.get(); - if (!objectIdsContain(req.getUpdatedEntityIds(), objectId)) { + if (!objectIdsContain(req.getUpdatedEntityIds(), objectId) && !objectIdsContain(req.getCreatedEntityIds(), objectId)) { req.recordEntityUpdate(objectId); } }
