Skip to content

Commit

Permalink
Merge pull request #2419 from atlanhq/nb/hasLineage
Browse files Browse the repository at this point in the history
[stag] Nb/has lineage Logging
  • Loading branch information
mehtaanshul authored Oct 25, 2023
2 parents de3c62a + e31dc25 commit c8735ce
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2478,10 +2478,14 @@ public void repairHasLineage(AtlasHasLineageRequests requests) throws AtlasBaseE
private void repairHasLineageForAsset(AtlasHasLineageRequest request) {
//only supports repairing scenario mentioned here - https://atlanhq.atlassian.net/browse/DG-128?focusedCommentId=20652

AtlasPerfMetrics.MetricRecorder metricRecorder = RequestContext.get().startMetricRecord("repairHasLineageForAssetGetById");
AtlasVertex assetVertex = AtlasGraphUtilsV2.findByGuid(this.graph, request.getAssetGuid());
RequestContext.get().endMetricRecord(metricRecorder);

if (getEntityHasLineage(assetVertex)) {
metricRecorder = RequestContext.get().startMetricRecord("repairHasLineageForAssetGetRelations");
Iterator<AtlasEdge> lineageEdges = assetVertex.getEdges(AtlasEdgeDirection.BOTH, PROCESS_EDGE_LABELS).iterator();
RequestContext.get().endMetricRecord(metricRecorder);
boolean foundActiveRel = false;

while (lineageEdges.hasNext()) {
Expand All @@ -2493,7 +2497,10 @@ private void repairHasLineageForAsset(AtlasHasLineageRequest request) {
}

if (!foundActiveRel) {
metricRecorder = RequestContext.get().startMetricRecord("repairHasLineageForRequiredAsset");
AtlasGraphUtilsV2.setEncodedProperty(assetVertex, HAS_LINEAGE, false);
LOG.info("repairHasLineage: repairHasLineageForAsset: Repaired {}", request.getAssetGuid());
RequestContext.get().endMetricRecord(metricRecorder);
}
}
}
Expand Down

0 comments on commit c8735ce

Please sign in to comment.