Repository: atlas Updated Branches: refs/heads/branch-1.0 3483b71c7 -> 5c0a2023a
ATLAS-2840: Regression - Tag Propagation, Deleted Entity : When an entity is deleted, tags propagated to it are removed (cherry picked from commit b9637b9a87376353c821606b5d3894a0fc1c7993) Project: http://git-wip-us.apache.org/repos/asf/atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/1ea772f4 Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/1ea772f4 Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/1ea772f4 Branch: refs/heads/branch-1.0 Commit: 1ea772f449ceb698aa95ca4ca9349e401ff0ced1 Parents: 3483b71 Author: Sarath Subramanian <[email protected]> Authored: Sun Aug 26 23:54:17 2018 -0700 Committer: Sarath Subramanian <[email protected]> Committed: Sun Aug 26 23:55:29 2018 -0700 ---------------------------------------------------------------------- .../java/org/apache/atlas/repository/graph/GraphHelper.java | 4 ++++ .../atlas/repository/store/graph/v1/DeleteHandlerV1.java | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/atlas/blob/1ea772f4/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java index 7885da3..b4189d2 100755 --- a/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java +++ b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java @@ -98,6 +98,7 @@ import static org.apache.atlas.repository.Constants.RELATIONSHIPTYPE_BLOCKED_PRO import static org.apache.atlas.repository.Constants.RELATIONSHIPTYPE_TAG_PROPAGATION_KEY; import static org.apache.atlas.repository.Constants.STATE_PROPERTY_KEY; import static org.apache.atlas.repository.Constants.SUPER_TYPES_PROPERTY_KEY; +import static org.apache.atlas.repository.Constants.TERM_ASSIGNMENT_LABEL; import static org.apache.atlas.repository.Constants.TIMESTAMP_PROPERTY_KEY; import static org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2.isReference; import static org.apache.atlas.type.AtlasStructType.AtlasAttribute.AtlasRelationshipEdgeDirection.BOTH; @@ -165,6 +166,9 @@ public final class GraphHelper { return INSTANCE; } + public static boolean isTermEntityEdge(AtlasEdge edge) { + return StringUtils.equals(edge.getLabel(), TERM_ASSIGNMENT_LABEL); + } public AtlasVertex createVertexWithIdentity(Referenceable typedInstance, Set<String> superTypeNames) { final String guid = UUID.randomUUID().toString(); http://git-wip-us.apache.org/repos/asf/atlas/blob/1ea772f4/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java index 5a2d766..c57e30a 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java @@ -29,7 +29,6 @@ import org.apache.atlas.model.instance.AtlasEntity.Status; import org.apache.atlas.model.instance.AtlasObjectId; import org.apache.atlas.model.typedef.AtlasRelationshipDef.PropagateTags; import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef; -import org.apache.atlas.repository.Constants; import org.apache.atlas.repository.graph.AtlasEdgeLabel; import org.apache.atlas.repository.graph.GraphHelper; import org.apache.atlas.repository.graphdb.AtlasEdge; @@ -449,8 +448,14 @@ public abstract class DeleteHandlerV1 { } } + boolean isTermEntityEdge = isTermEntityEdge(edge); + for (AtlasVertex classificationVertex : removePropagationsMap.keySet()) { - removeTagPropagation(classificationVertex, removePropagationsMap.get(classificationVertex)); + boolean removePropagations = getRemovePropagations(classificationVertex); + + if (isTermEntityEdge || removePropagations) { + removeTagPropagation(classificationVertex, removePropagationsMap.get(classificationVertex)); + } } }
