Commit eb641d56 by Sarath Subramanian

ATLAS-3863: Avoid re-evaluating tag propagation when deleting relationship (edge)

parent 25ba9b30
...@@ -407,22 +407,8 @@ public final class GraphHelper { ...@@ -407,22 +407,8 @@ public final class GraphHelper {
return ret; return ret;
} }
public static List<AtlasEdge> getIncomingClassificationEdges(AtlasVertex classificationVertex) { public static boolean hasEntityReferences(AtlasVertex classificationVertex) {
List<AtlasEdge> ret = new ArrayList<>(); return classificationVertex.hasEdges(AtlasEdgeDirection.IN, CLASSIFICATION_LABEL);
String classificationName = getTypeName(classificationVertex);
Iterable edges = classificationVertex.query().direction(AtlasEdgeDirection.IN).label(CLASSIFICATION_LABEL)
.has(CLASSIFICATION_EDGE_NAME_PROPERTY_KEY, classificationName).edges();
if (edges != null) {
Iterator<AtlasEdge> iterator = edges.iterator();
while (iterator.hasNext()) {
AtlasEdge edge = iterator.next();
ret.add(edge);
}
}
return ret;
} }
public static List<AtlasVertex> getAllPropagatedEntityVertices(AtlasVertex classificationVertex) { public static List<AtlasVertex> getAllPropagatedEntityVertices(AtlasVertex classificationVertex) {
......
...@@ -156,9 +156,6 @@ public abstract class DeleteHandlerV1 { ...@@ -156,9 +156,6 @@ public abstract class DeleteHandlerV1 {
continue; continue;
} }
// re-evaluate tag propagation
removeTagPropagation(edge);
deleteEdge(edge, isInternal || forceDelete); deleteEdge(edge, isInternal || forceDelete);
} }
} }
...@@ -974,10 +971,8 @@ public abstract class DeleteHandlerV1 { ...@@ -974,10 +971,8 @@ public abstract class DeleteHandlerV1 {
LOG.debug("Deleting classification vertex", string(classificationVertex)); LOG.debug("Deleting classification vertex", string(classificationVertex));
} }
List<AtlasEdge> incomingClassificationEdges = getIncomingClassificationEdges(classificationVertex);
// delete classification vertex only if it has no more entity references (direct or propagated) // delete classification vertex only if it has no more entity references (direct or propagated)
if (CollectionUtils.isEmpty(incomingClassificationEdges)) { if (!hasEntityReferences(classificationVertex)) {
_deleteVertex(classificationVertex, force); _deleteVertex(classificationVertex, force);
} }
} }
......
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