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 0a6cbccd2a..d4437922b6 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 @@ -1527,6 +1527,8 @@ public void resetHasLineageOnInputOutputDelete(Collection removedEdge private void updateAssetHasLineageStatus(AtlasVertex assetVertex, AtlasEdge currentEdge, Collection removedEdges) { AtlasPerfMetrics.MetricRecorder metricRecorder = RequestContext.get().startMetricRecord("updateAssetHasLineageStatus"); + removedEdges.forEach(edge -> RequestContext.get().addToDeletedEdgesIdsForResetHasLineage(edge.getIdForDisplay())); + Iterator edgeIterator = assetVertex.query() .direction(AtlasEdgeDirection.BOTH) .label(PROCESS_EDGE_LABELS) @@ -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) { diff --git a/server-api/src/main/java/org/apache/atlas/RequestContext.java b/server-api/src/main/java/org/apache/atlas/RequestContext.java index e3cbeb5d94..99568e89ee 100644 --- a/server-api/src/main/java/org/apache/atlas/RequestContext.java +++ b/server-api/src/main/java/org/apache/atlas/RequestContext.java @@ -94,6 +94,8 @@ public class RequestContext { private boolean allowDuplicateDisplayName; private MetricsRegistry metricsRegistry; private boolean skipAuthorizationCheck = false; + private Set deletedEdgesIdsForResetHasLineage = new HashSet<>(0); + private RequestContext() { } @@ -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(); @@ -389,6 +392,14 @@ public Set getDeletedEdgesIds() { return deletedEdgesIds; } + public void addToDeletedEdgesIdsForResetHasLineage(String edgeId) { + deletedEdgesIdsForResetHasLineage.add(edgeId); + } + + public Set getDeletedEdgesIdsForResetHasLineage() { + return deletedEdgesIdsForResetHasLineage; + } + public Set getProcessGuidIds() { return processGuidIds; }