You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by sa...@apache.org on 2021/04/30 05:00:42 UTC

[atlas] branch branch-2.0 updated: ATLAS-4269: Deferred Actions : When a tag is propagated from an entity via 2 processes , blocking 1 process removes tag propagated from another process

This is an automated email from the ASF dual-hosted git repository.

sarath pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 06dbe0f  ATLAS-4269: Deferred Actions : When a tag is propagated from an entity via 2 processes , blocking 1 process removes tag propagated from another process
06dbe0f is described below

commit 06dbe0f0feda648bae41ab170984bf7c4fb94da5
Author: Sarath Subramanian <sa...@apache.org>
AuthorDate: Thu Apr 29 21:00:44 2021 -0700

    ATLAS-4269: Deferred Actions : When a tag is propagated from an entity via 2 processes , blocking 1 process removes tag propagated from another process
    
    (cherry picked from commit 85e3c5cf64747432bd434bbf1573224988c37bf6)
---
 .../repository/store/graph/v2/EntityGraphRetriever.java    | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
index 9abcf64..7948475 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
@@ -531,9 +531,9 @@ public class EntityGraphRetriever {
 
     private void traverseImpactedVertices(final AtlasVertex entityVertexStart, final String relationshipGuidToExclude,
                                           final String classificationId, final List<AtlasVertex> result) {
-        Set<String> visitedVertices = new HashSet<>();
-
-        Queue<AtlasVertex> queue = new ArrayDeque<AtlasVertex>() {{ add(entityVertexStart); }};
+        Set<String>              visitedVertices = new HashSet<>();
+        Queue<AtlasVertex>       queue           = new ArrayDeque<AtlasVertex>() {{ add(entityVertexStart); }};
+        Map<String, AtlasVertex> resultsMap      = new HashMap<>();
 
         while (!queue.isEmpty()) {
             AtlasVertex entityVertex   = queue.poll();
@@ -555,6 +555,7 @@ public class EntityGraphRetriever {
             }
 
             Iterable<AtlasEdge> propagationEdges = entityVertex.getEdges(AtlasEdgeDirection.BOTH, tagPropagationEdges);
+
             for (AtlasEdge propagationEdge : propagationEdges) {
                 if (getEdgeStatus(propagationEdge) != ACTIVE) {
                     continue;
@@ -582,6 +583,7 @@ public class EntityGraphRetriever {
 
                 if (classificationId != null) {
                     List<String> blockedClassificationIds = getBlockedClassificationIds(propagationEdge);
+
                     if (CollectionUtils.isNotEmpty(blockedClassificationIds) && blockedClassificationIds.contains(classificationId)) {
                         continue;
                     }
@@ -590,13 +592,15 @@ public class EntityGraphRetriever {
                 AtlasVertex adjacentVertex             = getOtherVertex(propagationEdge, entityVertex);
                 String      adjacentVertexIdForDisplay = adjacentVertex.getIdForDisplay();
 
-                if (!visitedVertices.contains(adjacentVertexIdForDisplay)) {
-                    result.add(adjacentVertex);
+                if (!visitedVertices.contains(adjacentVertexIdForDisplay) && !resultsMap.containsKey(adjacentVertexIdForDisplay)) {
+                    resultsMap.put(adjacentVertexIdForDisplay, adjacentVertex);
 
                     queue.add(adjacentVertex);
                 }
             }
         }
+
+        result.addAll(resultsMap.values());
     }
 
     private boolean isOutVertex(AtlasVertex vertex, AtlasEdge edge) {