Skip to content

Commit

Permalink
Merge pull request #2386 from atlanhq/nb/hasLineage
Browse files Browse the repository at this point in the history
DG-128 Fix __hasLineage filter issue
  • Loading branch information
nikhilbonte21 authored Sep 25, 2023
2 parents 591836e + 830cde4 commit 198078f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1527,6 +1527,8 @@ public void resetHasLineageOnInputOutputDelete(Collection<AtlasEdge> removedEdge
private void updateAssetHasLineageStatus(AtlasVertex assetVertex, AtlasEdge currentEdge, Collection<AtlasEdge> removedEdges) {
AtlasPerfMetrics.MetricRecorder metricRecorder = RequestContext.get().startMetricRecord("updateAssetHasLineageStatus");

removedEdges.forEach(edge -> RequestContext.get().addToDeletedEdgesIdsForResetHasLineage(edge.getIdForDisplay()));

Iterator<AtlasEdge> edgeIterator = assetVertex.query()
.direction(AtlasEdgeDirection.BOTH)
.label(PROCESS_EDGE_LABELS)
Expand All @@ -1537,7 +1539,7 @@ private void updateAssetHasLineageStatus(AtlasVertex assetVertex, AtlasEdge curr
int processHasLineageCount = 0;
while (edgeIterator.hasNext()) {
AtlasEdge edge = edgeIterator.next();
if (!removedEdges.contains(edge) && !currentEdge.equals(edge)) {
if (!RequestContext.get().getDeletedEdgesIdsForResetHasLineage().contains(edge.getIdForDisplay()) && !currentEdge.equals(edge)) {
AtlasVertex relatedProcessVertex = edge.getOutVertex();
boolean processHasLineage = getEntityHasLineage(relatedProcessVertex);
if (processHasLineage) {
Expand Down
11 changes: 11 additions & 0 deletions server-api/src/main/java/org/apache/atlas/RequestContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ public class RequestContext {
private boolean allowDuplicateDisplayName;
private MetricsRegistry metricsRegistry;
private boolean skipAuthorizationCheck = false;
private Set<String> deletedEdgesIdsForResetHasLineage = new HashSet<>(0);


private RequestContext() {
}
Expand Down Expand Up @@ -147,6 +149,7 @@ public void clearCache() {
this.removedElementsMap.clear();
this.deletedEdgesIds.clear();
this.processGuidIds.clear();
this.deletedEdgesIdsForResetHasLineage.clear();
this.requestContextHeaders.clear();
this.relationshipEndToVertexIdMap.clear();
this.relationshipMutationMap.clear();
Expand Down Expand Up @@ -389,6 +392,14 @@ public Set<String> getDeletedEdgesIds() {
return deletedEdgesIds;
}

public void addToDeletedEdgesIdsForResetHasLineage(String edgeId) {
deletedEdgesIdsForResetHasLineage.add(edgeId);
}

public Set<String> getDeletedEdgesIdsForResetHasLineage() {
return deletedEdgesIdsForResetHasLineage;
}

public Set<String> getProcessGuidIds() {
return processGuidIds;
}
Expand Down

0 comments on commit 198078f

Please sign in to comment.