You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by am...@apache.org on 2020/04/07 05:09:41 UTC

[atlas] branch branch-2.0 updated (eb63199 -> e20c370)

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

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


    from eb63199  ATLAS-3708: Update Hive hook to create ADLS-Gen2 entities for ABFS path references
     new 83c62c1  ATLAS-3702: Edge creation performance improvements.
     new e20c370  ATLAS-3702: Edge creation performance improvements. Part 2.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/atlas/repository/graph/GraphHelper.java | 44 ++++++----------------
 .../store/graph/v2/AtlasRelationshipStoreV2.java   |  2 +-
 2 files changed, 12 insertions(+), 34 deletions(-)


[atlas] 02/02: ATLAS-3702: Edge creation performance improvements. Part 2.

Posted by am...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit e20c3703a8873cb370f59103a88fb7ea2a99c92a
Author: Ashutosh Mestry <am...@cloudera.com>
AuthorDate: Mon Apr 6 16:37:20 2020 -0700

    ATLAS-3702: Edge creation performance improvements. Part 2.
---
 .../atlas/repository/store/graph/v2/AtlasRelationshipStoreV2.java       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasRelationshipStoreV2.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasRelationshipStoreV2.java
index fdf117a..6b5615f 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasRelationshipStoreV2.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasRelationshipStoreV2.java
@@ -781,7 +781,7 @@ public class AtlasRelationshipStoreV2 implements AtlasRelationshipStore {
             if (edge != null) {
                 Status status = graphHelper.getStatus(edge);
 
-                if ((status == null || status == ACTIVE) && edge.getOutVertex().equals(fromVertex)) {
+                if ((status == null || status == ACTIVE) && edge.getOutVertex().getId().equals(fromVertex.getId())) {
                     ret = edge;
                     break;
                 }


[atlas] 01/02: ATLAS-3702: Edge creation performance improvements.

Posted by am...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 83c62c1d857c42c15d3f3ee2d2a831a1bba28caf
Author: Ashutosh Mestry <am...@cloudera.com>
AuthorDate: Thu Apr 2 08:18:18 2020 -0700

    ATLAS-3702: Edge creation performance improvements.
---
 .../apache/atlas/repository/graph/GraphHelper.java | 44 ++++++----------------
 1 file changed, 11 insertions(+), 33 deletions(-)

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 5ab9f4d..dfaa739 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
@@ -36,6 +36,7 @@ import org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2;
 import org.apache.atlas.type.AtlasArrayType;
 import org.apache.atlas.type.AtlasMapType;
 import org.apache.atlas.util.AtlasGremlinQueryProvider;
+import org.apache.atlas.utils.AtlasPerfMetrics;
 import org.apache.atlas.v1.model.instance.Id;
 import org.apache.atlas.v1.model.instance.Referenceable;
 import org.apache.atlas.type.AtlasStructType.AtlasAttribute;
@@ -225,7 +226,7 @@ public final class GraphHelper {
 
                 while (edges.hasNext()) {
                     AtlasEdge edge = edges.next();
-                    if (edge.getOutVertex().equals(outVertex)) {
+                    if (edge.getOutVertex().getId().equals(outVertex.getId())) {
                         Id.EntityState edgeState = getState(edge);
                         if (edgeState == null || edgeState == Id.EntityState.ACTIVE) {
                             return edge;
@@ -318,43 +319,18 @@ public final class GraphHelper {
     //In some cases of parallel APIs, the edge is added, but get edge by label doesn't return the edge. ATLAS-1104
     //So traversing all the edges
     public static Iterator<AtlasEdge> getAdjacentEdgesByLabel(AtlasVertex instanceVertex, AtlasEdgeDirection direction, final String edgeLabel) {
+        AtlasPerfMetrics.MetricRecorder metric = RequestContext.get().startMetricRecord("getAdjacentEdgesByLabel");
         if (LOG.isDebugEnabled()) {
             LOG.debug("Finding edges for {} with label {}", string(instanceVertex), edgeLabel);
         }
 
+        Iterator<AtlasEdge> ret = null;
         if(instanceVertex != null && edgeLabel != null) {
-            final Iterator<AtlasEdge> iterator = instanceVertex.getEdges(direction).iterator();
-            return new Iterator<AtlasEdge>() {
-                private AtlasEdge edge = null;
-
-                @Override
-                public boolean hasNext() {
-                    while (edge == null && iterator.hasNext()) {
-                        AtlasEdge localEdge = iterator.next();
-                        if (localEdge.getLabel().equals(edgeLabel)) {
-                            edge = localEdge;
-                        }
-                    }
-                    return edge != null;
-                }
-
-                @Override
-                public AtlasEdge next() {
-                    if (hasNext()) {
-                        AtlasEdge localEdge = edge;
-                        edge = null;
-                        return localEdge;
-                    }
-                    return null;
-                }
-
-                @Override
-                public void remove() {
-                    throw new IllegalStateException("Not handled");
-                }
-            };
+            ret = instanceVertex.getEdges(direction, edgeLabel).iterator();
         }
-        return null;
+
+        RequestContext.get().endMetricRecord(metric);
+        return ret;
     }
 
     public static boolean isPropagationEnabled(AtlasVertex classificationVertex) {
@@ -1449,7 +1425,9 @@ public final class GraphHelper {
 
     private static void sortCollectionElements(AtlasAttribute attribute, List<AtlasEdge> edges) {
         // sort array elements based on edge index
-        if (attribute.getAttributeType() instanceof AtlasArrayType && CollectionUtils.isNotEmpty(edges)) {
+        if (attribute.getAttributeType() instanceof AtlasArrayType &&
+                CollectionUtils.isNotEmpty(edges) &&
+                edges.get(0).getProperty(ATTRIBUTE_INDEX_PROPERTY_KEY, Integer.class) != null) {
             Collections.sort(edges, (e1, e2) -> {
                 Integer e1Index = getIndexValue(e1);
                 Integer e2Index = getIndexValue(e2);