ATLAS-4803: Optimize Relationship Edge fetch
Signed-off-by: Pinal Shah <pinal.shah@freestoneinfotech.com>
This commit is contained in:
parent
8bc7a29055
commit
12b81d79e7
|
|
@ -575,15 +575,19 @@ public class AtlasJanusGraph implements AtlasGraph<AtlasJanusVertex, AtlasJanusE
|
|||
}
|
||||
}
|
||||
private Edge getFirstActiveEdge(GraphTraversal gt) {
|
||||
while (gt.hasNext()) {
|
||||
Edge gremlinEdge = (Edge) gt.next();
|
||||
if (gremlinEdge != null && gremlinEdge.property(STATE_PROPERTY_KEY).isPresent() &&
|
||||
gremlinEdge.property(STATE_PROPERTY_KEY).value().equals(AtlasEntity.Status.ACTIVE.toString())
|
||||
) {
|
||||
return gremlinEdge;
|
||||
|
||||
if(gt != null) {
|
||||
while (gt.hasNext()) {
|
||||
Edge gremlinEdge = (Edge) gt.next();
|
||||
if (gremlinEdge != null && gremlinEdge.property(STATE_PROPERTY_KEY).isPresent() &&
|
||||
gremlinEdge.property(STATE_PROPERTY_KEY).value().equals(AtlasEntity.Status.ACTIVE.toString())
|
||||
) {
|
||||
return gremlinEdge;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -648,9 +648,7 @@ public class AtlasRelationshipStoreV2 implements AtlasRelationshipStore {
|
|||
|
||||
AtlasEdge ret = null;
|
||||
|
||||
if (toVertex.hasEdges(AtlasEdgeDirection.IN, relationshipLabel) && fromVertex.hasEdges(AtlasEdgeDirection.OUT, relationshipLabel)) {
|
||||
ret = graph.getEdgeBetweenVertices(fromVertex, toVertex, relationshipLabel);
|
||||
}
|
||||
ret = graph.getEdgeBetweenVertices(fromVertex, toVertex, relationshipLabel);
|
||||
|
||||
RequestContext.get().endMetricRecord(metric);
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Reference in New Issue