Commit ad4db42e by Ashutosh Mestry Committed by Madhan Neethiraj

ATLAS-2434: Performance improvement for import operation.

parent 4582d4a4
...@@ -253,7 +253,8 @@ public class AtlasGraphUtilsV1 { ...@@ -253,7 +253,8 @@ public class AtlasGraphUtilsV1 {
} else { } else {
vertex = AtlasGraphUtilsV1.findByTypeAndPropertyName(entityType.getTypeName(), attribute.getVertexPropertyName(), attrValue); 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); vertex = AtlasGraphUtilsV1.findBySuperTypeAndPropertyName(entityType.getTypeName(), attribute.getVertexPropertyName(), attrValue);
} }
} }
......
...@@ -19,6 +19,7 @@ package org.apache.atlas.repository.store.graph.v1; ...@@ -19,6 +19,7 @@ package org.apache.atlas.repository.store.graph.v1;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import org.apache.atlas.AtlasErrorCode; import org.apache.atlas.AtlasErrorCode;
import org.apache.atlas.RequestContextV1;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.impexp.AtlasImportResult; import org.apache.atlas.model.impexp.AtlasImportResult;
import org.apache.atlas.model.instance.AtlasEntity; import org.apache.atlas.model.instance.AtlasEntity;
...@@ -98,6 +99,8 @@ public class BulkImporterImpl implements BulkImporter { ...@@ -98,6 +99,8 @@ public class BulkImporterImpl implements BulkImporter {
if (!updateResidualList(abe, residualList, entityWithExtInfo.getEntity().getGuid())) { if (!updateResidualList(abe, residualList, entityWithExtInfo.getEntity().getGuid())) {
throw abe; throw abe;
} }
} finally {
RequestContextV1.clear();
} }
} }
......
...@@ -1463,7 +1463,7 @@ public class EntityGraphMapper { ...@@ -1463,7 +1463,7 @@ public class EntityGraphMapper {
AtlasObjectId objectId = new AtlasObjectId(GraphHelper.getGuid(vertex), GraphHelper.getTypeName(vertex)); AtlasObjectId objectId = new AtlasObjectId(GraphHelper.getGuid(vertex), GraphHelper.getTypeName(vertex));
RequestContextV1 req = RequestContextV1.get(); RequestContextV1 req = RequestContextV1.get();
if (!objectIdsContain(req.getUpdatedEntityIds(), objectId)) { if (!objectIdsContain(req.getUpdatedEntityIds(), objectId) && !objectIdsContain(req.getCreatedEntityIds(), objectId)) {
req.recordEntityUpdate(objectId); req.recordEntityUpdate(objectId);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment