From 0cb18dde8aa04648c3d83c61c170363baeb6bc7a Mon Sep 17 00:00:00 2001 From: Bichitra Kumar Sahoo <32828151+bichitra95@users.noreply.github.com> Date: Mon, 5 Aug 2024 22:05:06 +0530 Subject: [PATCH 01/13] DQ-165: Prevent user YAML override --- .../v2/preprocessor/contract/ContractPreProcessor.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/contract/ContractPreProcessor.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/contract/ContractPreProcessor.java index ac3df2535f..5bddc4c0da 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/contract/ContractPreProcessor.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/contract/ContractPreProcessor.java @@ -110,7 +110,9 @@ private void processCreateContract(AtlasEntity entity, EntityMutationContext con boolean contractSync = syncContractCertificateStatus(entity, contract); contractString = DataContract.serialize(contract); - entity.setAttribute(ATTR_CONTRACT, contractString); + if (!isContractYaml(entity)) { + entity.setAttribute(ATTR_CONTRACT, contractString); + } String contractStringJSON = DataContract.serializeJSON(contract); entity.setAttribute(ATTR_CONTRACT_JSON, contractStringJSON); @@ -298,4 +300,8 @@ private static String getContractString(AtlasEntity entity) { } return contractString; } + + private static boolean isContractYaml(AtlasEntity entity) { + return !StringUtils.isEmpty((String) entity.getAttribute(ATTR_CONTRACT)); + } } From 3853127c8a61d0e1bdf73245e098700f08fdb8c2 Mon Sep 17 00:00:00 2001 From: Bichitra Kumar Sahoo <32828151+bichitra95@users.noreply.github.com> Date: Tue, 6 Aug 2024 10:45:53 +0530 Subject: [PATCH 02/13] Serialize to YAML moved to if condition --- .../graph/v2/preprocessor/contract/ContractPreProcessor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/contract/ContractPreProcessor.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/contract/ContractPreProcessor.java index 5bddc4c0da..abe1c46170 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/contract/ContractPreProcessor.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/contract/ContractPreProcessor.java @@ -109,8 +109,8 @@ private void processCreateContract(AtlasEntity entity, EntityMutationContext con authorizeContractCreateOrUpdate(entity, associatedAsset); boolean contractSync = syncContractCertificateStatus(entity, contract); - contractString = DataContract.serialize(contract); if (!isContractYaml(entity)) { + contractString = DataContract.serialize(contract); entity.setAttribute(ATTR_CONTRACT, contractString); } String contractStringJSON = DataContract.serializeJSON(contract); From 051bcea9a4f09b4a37b49d194a31c62af3c8bbc9 Mon Sep 17 00:00:00 2001 From: aarshi Date: Thu, 17 Oct 2024 15:31:46 +0530 Subject: [PATCH 03/13] add label processors --- .../java/org/apache/atlas/RequestContext.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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 22b046bab0..bea34631fd 100644 --- a/server-api/src/main/java/org/apache/atlas/RequestContext.java +++ b/server-api/src/main/java/org/apache/atlas/RequestContext.java @@ -69,8 +69,9 @@ public class RequestContext { private static String USERNAME = ""; private final Map> removedElementsMap = new HashMap<>(); private final Map> newElementsCreatedMap = new HashMap<>(); - private final Map> relationshipMutationMap = new HashMap<>(); + private final Set processEdgeLabels = new HashSet<>(); + private final Set assetEdgeLabels = new HashSet<>(); private String user; private Set userGroups; @@ -798,4 +799,20 @@ public void clearMutationContext(String event) { public Map> getRelationshipMutationMap() { return relationshipMutationMap; } + + public void addProcessEdgeLabel(String processEdgeLabel) { + processEdgeLabels.add(processEdgeLabel); + } + + public void addAssetEdgeLabel(String assetEdgeLabel) { + assetEdgeLabels.add(assetEdgeLabel); + } + + public boolean isProcessEdgeLabelAlreadyProcessed(String processEdgeLabel) { + return processEdgeLabels.contains(processEdgeLabel); + } + + public boolean isAssetEdgeLabelAlreadyProcessed(String assetEdgeLabel) { + return assetEdgeLabels.add(assetEdgeLabel); + } } \ No newline at end of file From 3c1d669c1ca6647a95edf122e5d93e51e9d13c73 Mon Sep 17 00:00:00 2001 From: aarshi Date: Thu, 17 Oct 2024 15:33:16 +0530 Subject: [PATCH 04/13] skip computation if label vertex combination exists --- .../store/graph/v1/DeleteHandlerV1.java | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) 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 02ff0030c7..a7048626df 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 @@ -1485,6 +1485,7 @@ public void removeHasLineageOnDelete(Collection vertices) throws At public void resetHasLineageOnInputOutputDelete(Collection removedEdges, AtlasVertex deletedVertex) throws AtlasBaseException { AtlasPerfMetrics.MetricRecorder metricRecorder = RequestContext.get().startMetricRecord("resetHasLineageOnInputOutputDelete"); + RequestContext context = RequestContext.get(); for (AtlasEdge atlasEdge : removedEdges) { AtlasPerfMetrics.MetricRecorder metricRecorder1 = RequestContext.get().startMetricRecord("resetHasLineageDeletedEdges"); @@ -1493,14 +1494,31 @@ public void resetHasLineageOnInputOutputDelete(Collection removedEdge AtlasVertex processVertex = atlasEdge.getOutVertex(); AtlasVertex assetVertex = atlasEdge.getInVertex(); + String assetEdgeLabel = getLabel(AtlasGraphUtilsV2.getIdFromVertex(assetVertex), atlasEdge.getLabel()); + + if (context.isAssetEdgeLabelAlreadyProcessed(assetEdgeLabel)) { + continue; + }else { + context.addAssetEdgeLabel(assetEdgeLabel); + } if (getStatus(assetVertex) == ACTIVE && !assetVertex.equals(deletedVertex)) { - updateAssetHasLineageStatus(assetVertex, atlasEdge, removedEdges); + updateAssetHasLineageStatus(assetVertex, atlasEdge, removedEdges);; } - if (getStatus(processVertex) == ACTIVE && !processVertex.equals(deletedVertex)) { + if (getStatus(processVertex) == ACTIVE && !processVertex.equals(deletedVertex)) { String edgeLabel = isOutputEdge ? PROCESS_OUTPUTS : PROCESS_INPUTS; + String processId = AtlasGraphUtilsV2.getIdFromVertex(processVertex); + String processEdgeLabel = getLabel(processId,edgeLabel); + + if (context.isProcessEdgeLabelAlreadyProcessed(processEdgeLabel)) { + continue; + }else { + context.addProcessEdgeLabel(processEdgeLabel); + } + + Iterator edgeIterator = GraphHelper.getActiveEdges(processVertex, edgeLabel, AtlasEdgeDirection.BOTH); boolean activeEdgeFound = false; @@ -1524,6 +1542,15 @@ public void resetHasLineageOnInputOutputDelete(Collection removedEdge String oppositeEdgeLabel = isOutputEdge ? PROCESS_INPUTS : PROCESS_OUTPUTS; + processEdgeLabel = getLabel(processId, oppositeEdgeLabel); + + if (context.isProcessEdgeLabelAlreadyProcessed(processEdgeLabel)) { + continue; + }else { + context.addProcessEdgeLabel(processEdgeLabel); + } + + Iterator processEdgeIterator = GraphHelper.getActiveEdges(processVertex, oppositeEdgeLabel, AtlasEdgeDirection.BOTH); while (processEdgeIterator.hasNext()) { @@ -1543,6 +1570,10 @@ public void resetHasLineageOnInputOutputDelete(Collection removedEdge RequestContext.get().endMetricRecord(metricRecorder); } + private String getLabel(String guid, String label){ + return guid + ":" + label; + } + private void updateAssetHasLineageStatus(AtlasVertex assetVertex, AtlasEdge currentEdge, Collection removedEdges) { AtlasPerfMetrics.MetricRecorder metricRecorder = RequestContext.get().startMetricRecord("updateAssetHasLineageStatus"); From 683b5d607bbfedf3fc192ce50524c91b5b20c0f5 Mon Sep 17 00:00:00 2001 From: aarshi Date: Thu, 17 Oct 2024 15:37:01 +0530 Subject: [PATCH 05/13] nit --- .../apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 a7048626df..a20ae73a35 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 @@ -1503,7 +1503,7 @@ public void resetHasLineageOnInputOutputDelete(Collection removedEdge } if (getStatus(assetVertex) == ACTIVE && !assetVertex.equals(deletedVertex)) { - updateAssetHasLineageStatus(assetVertex, atlasEdge, removedEdges);; + updateAssetHasLineageStatus(assetVertex, atlasEdge, removedEdges); } if (getStatus(processVertex) == ACTIVE && !processVertex.equals(deletedVertex)) { From 045f8df5c19cf7a5a733b5393ebf56bc7645188b Mon Sep 17 00:00:00 2001 From: aarshi Date: Thu, 17 Oct 2024 15:51:13 +0530 Subject: [PATCH 06/13] tweak condition --- .../repository/store/graph/v1/DeleteHandlerV1.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) 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 a20ae73a35..7bea51e386 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 @@ -1496,14 +1496,10 @@ public void resetHasLineageOnInputOutputDelete(Collection removedEdge AtlasVertex assetVertex = atlasEdge.getInVertex(); String assetEdgeLabel = getLabel(AtlasGraphUtilsV2.getIdFromVertex(assetVertex), atlasEdge.getLabel()); - if (context.isAssetEdgeLabelAlreadyProcessed(assetEdgeLabel)) { - continue; - }else { - context.addAssetEdgeLabel(assetEdgeLabel); - } - - if (getStatus(assetVertex) == ACTIVE && !assetVertex.equals(deletedVertex)) { + if (!context.isAssetEdgeLabelAlreadyProcessed(assetEdgeLabel) && getStatus(assetVertex) == ACTIVE && !assetVertex.equals(deletedVertex)) { updateAssetHasLineageStatus(assetVertex, atlasEdge, removedEdges); + } else if (!context.isAssetEdgeLabelAlreadyProcessed(assetEdgeLabel)){ + context.addAssetEdgeLabel(assetEdgeLabel); } if (getStatus(processVertex) == ACTIVE && !processVertex.equals(deletedVertex)) { From fb7596c800ad6bc835739cd691756919da6e0ccb Mon Sep 17 00:00:00 2001 From: aarshi Date: Mon, 21 Oct 2024 10:53:02 +0530 Subject: [PATCH 07/13] remove map --- .../java/org/apache/atlas/RequestContext.java | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) 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 bea34631fd..7f05a1b303 100644 --- a/server-api/src/main/java/org/apache/atlas/RequestContext.java +++ b/server-api/src/main/java/org/apache/atlas/RequestContext.java @@ -70,8 +70,7 @@ public class RequestContext { private final Map> removedElementsMap = new HashMap<>(); private final Map> newElementsCreatedMap = new HashMap<>(); private final Map> relationshipMutationMap = new HashMap<>(); - private final Set processEdgeLabels = new HashSet<>(); - private final Set assetEdgeLabels = new HashSet<>(); + private final Set edgeLabels = new HashSet<>(); private String user; private Set userGroups; @@ -800,19 +799,12 @@ public Map> getRelationshipMutationMap() { return relationshipMutationMap; } - public void addProcessEdgeLabel(String processEdgeLabel) { - processEdgeLabels.add(processEdgeLabel); + public void addEdgeLabel(String processEdgeLabel) { + edgeLabels.add(processEdgeLabel); } - public void addAssetEdgeLabel(String assetEdgeLabel) { - assetEdgeLabels.add(assetEdgeLabel); + public boolean isEdgeLabelAlreadyProcessed(String processEdgeLabel) { + return edgeLabels.contains(processEdgeLabel); } - public boolean isProcessEdgeLabelAlreadyProcessed(String processEdgeLabel) { - return processEdgeLabels.contains(processEdgeLabel); - } - - public boolean isAssetEdgeLabelAlreadyProcessed(String assetEdgeLabel) { - return assetEdgeLabels.add(assetEdgeLabel); - } } \ No newline at end of file From 93a98993bf3ab45d0ebd487286c647267b57161c Mon Sep 17 00:00:00 2001 From: aarshi Date: Mon, 21 Oct 2024 10:56:57 +0530 Subject: [PATCH 08/13] Code refactoring --- .../store/graph/v1/DeleteHandlerV1.java | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) 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 7bea51e386..3996917be5 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 @@ -1485,7 +1485,6 @@ public void removeHasLineageOnDelete(Collection vertices) throws At public void resetHasLineageOnInputOutputDelete(Collection removedEdges, AtlasVertex deletedVertex) throws AtlasBaseException { AtlasPerfMetrics.MetricRecorder metricRecorder = RequestContext.get().startMetricRecord("resetHasLineageOnInputOutputDelete"); - RequestContext context = RequestContext.get(); for (AtlasEdge atlasEdge : removedEdges) { AtlasPerfMetrics.MetricRecorder metricRecorder1 = RequestContext.get().startMetricRecord("resetHasLineageDeletedEdges"); @@ -1494,26 +1493,27 @@ public void resetHasLineageOnInputOutputDelete(Collection removedEdge AtlasVertex processVertex = atlasEdge.getOutVertex(); AtlasVertex assetVertex = atlasEdge.getInVertex(); - String assetEdgeLabel = getLabel(AtlasGraphUtilsV2.getIdFromVertex(assetVertex), atlasEdge.getLabel()); + String assetEdgeLabel = getLabel(getGuid(assetVertex), atlasEdge.getLabel()); - if (!context.isAssetEdgeLabelAlreadyProcessed(assetEdgeLabel) && getStatus(assetVertex) == ACTIVE && !assetVertex.equals(deletedVertex)) { + boolean assetLabelPairAlreadyProcessed = RequestContext.get().isEdgeLabelAlreadyProcessed(assetEdgeLabel); + + if (!assetLabelPairAlreadyProcessed && getStatus(assetVertex) == ACTIVE && !assetVertex.equals(deletedVertex)) { updateAssetHasLineageStatus(assetVertex, atlasEdge, removedEdges); - } else if (!context.isAssetEdgeLabelAlreadyProcessed(assetEdgeLabel)){ - context.addAssetEdgeLabel(assetEdgeLabel); + } else if (!assetLabelPairAlreadyProcessed){ + RequestContext.get().addEdgeLabel(assetEdgeLabel); } if (getStatus(processVertex) == ACTIVE && !processVertex.equals(deletedVertex)) { String edgeLabel = isOutputEdge ? PROCESS_OUTPUTS : PROCESS_INPUTS; - String processId = AtlasGraphUtilsV2.getIdFromVertex(processVertex); + String processId = getGuid(processVertex); String processEdgeLabel = getLabel(processId,edgeLabel); + boolean processLabelPairAlreadyProcessed = RequestContext.get().isEdgeLabelAlreadyProcessed(processEdgeLabel); - if (context.isProcessEdgeLabelAlreadyProcessed(processEdgeLabel)) { + if (processLabelPairAlreadyProcessed) { continue; - }else { - context.addProcessEdgeLabel(processEdgeLabel); } - + RequestContext.get().addEdgeLabel(processEdgeLabel); Iterator edgeIterator = GraphHelper.getActiveEdges(processVertex, edgeLabel, AtlasEdgeDirection.BOTH); @@ -1539,13 +1539,12 @@ public void resetHasLineageOnInputOutputDelete(Collection removedEdge String oppositeEdgeLabel = isOutputEdge ? PROCESS_INPUTS : PROCESS_OUTPUTS; processEdgeLabel = getLabel(processId, oppositeEdgeLabel); + processLabelPairAlreadyProcessed = RequestContext.get().isEdgeLabelAlreadyProcessed(processEdgeLabel); - if (context.isProcessEdgeLabelAlreadyProcessed(processEdgeLabel)) { + if (processLabelPairAlreadyProcessed) { continue; - }else { - context.addProcessEdgeLabel(processEdgeLabel); } - + RequestContext.get().addEdgeLabel(processEdgeLabel); Iterator processEdgeIterator = GraphHelper.getActiveEdges(processVertex, oppositeEdgeLabel, AtlasEdgeDirection.BOTH); From fbba9c7e23b14f8633e70201e13e9a1e00c56c99 Mon Sep 17 00:00:00 2001 From: aarshi Date: Mon, 21 Oct 2024 11:21:45 +0530 Subject: [PATCH 09/13] refactoring --- .../atlas/repository/store/graph/v1/DeleteHandlerV1.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 fcccdeb55a..716fd87eb9 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 @@ -1495,12 +1495,12 @@ public void resetHasLineageOnInputOutputDelete(Collection removedEdge boolean assetLabelPairAlreadyProcessed = RequestContext.get().isEdgeLabelAlreadyProcessed(assetEdgeLabel); - if (!assetLabelPairAlreadyProcessed && getStatus(assetVertex) == ACTIVE && !assetVertex.equals(deletedVertex)) { - updateAssetHasLineageStatus(assetVertex, atlasEdge, removedEdges); - } else if (!assetLabelPairAlreadyProcessed){ + if (!assetLabelPairAlreadyProcessed) { RequestContext.get().addEdgeLabel(assetEdgeLabel); + if (getStatus(assetVertex) == ACTIVE && !assetVertex.equals(deletedVertex)) { + updateAssetHasLineageStatus(assetVertex, atlasEdge, removedEdges); + } } - if (getStatus(processVertex) == ACTIVE && !processVertex.equals(deletedVertex)) { String edgeLabel = isOutputEdge ? PROCESS_OUTPUTS : PROCESS_INPUTS; From 474fe2d2efe3a8fea923c7bad849ead53a4df408 Mon Sep 17 00:00:00 2001 From: aarshi Date: Mon, 21 Oct 2024 18:36:47 +0530 Subject: [PATCH 10/13] validate typeName exists --- .../repository/store/graph/v2/EntityGraphRetriever.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java index 60760d166a..8454cf2d53 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java @@ -1684,7 +1684,14 @@ private AtlasStruct mapVertexToStruct(AtlasVertex entityVertex, String edgeLabel if (GraphHelper.elementExists(edge)) { final AtlasVertex referenceVertex = edge.getInVertex(); - ret = new AtlasStruct(getTypeName(referenceVertex)); + + String typeName = getTypeName(referenceVertex); + + if (StringUtils.isEmpty(typeName)) { + throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_NOT_FOUND, typeName); + } + + ret = new AtlasStruct(typeName); mapAttributes(referenceVertex, ret, entityExtInfo, isMinExtInfo); } From d904cd8a781f0c9668b4e5b4e0b0d12ce9a18844 Mon Sep 17 00:00:00 2001 From: aarshi Date: Mon, 21 Oct 2024 19:10:08 +0530 Subject: [PATCH 11/13] add log --- .../atlas/repository/store/graph/v2/EntityGraphRetriever.java | 1 + 1 file changed, 1 insertion(+) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java index 8454cf2d53..f64b6c346a 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java @@ -1688,6 +1688,7 @@ private AtlasStruct mapVertexToStruct(AtlasVertex entityVertex, String edgeLabel String typeName = getTypeName(referenceVertex); if (StringUtils.isEmpty(typeName)) { + LOG.error("typeName not found for vertex {}", getGuid(referenceVertex) ); throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_NOT_FOUND, typeName); } From ae46e5bc802eba4bfc8b845ba33fb6a23fad340e Mon Sep 17 00:00:00 2001 From: aarshi Date: Wed, 23 Oct 2024 12:16:00 +0530 Subject: [PATCH 12/13] Minor optimisation --- .../store/graph/v1/DeleteHandlerV1.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) 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 716fd87eb9..537f27339f 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 @@ -1489,7 +1489,6 @@ public void resetHasLineageOnInputOutputDelete(Collection removedEdge boolean isOutputEdge = PROCESS_OUTPUTS.equals(atlasEdge.getLabel()); - AtlasVertex processVertex = atlasEdge.getOutVertex(); AtlasVertex assetVertex = atlasEdge.getInVertex(); String assetEdgeLabel = getLabel(getGuid(assetVertex), atlasEdge.getLabel()); @@ -1501,18 +1500,20 @@ public void resetHasLineageOnInputOutputDelete(Collection removedEdge updateAssetHasLineageStatus(assetVertex, atlasEdge, removedEdges); } } - if (getStatus(processVertex) == ACTIVE && !processVertex.equals(deletedVertex)) { - String edgeLabel = isOutputEdge ? PROCESS_OUTPUTS : PROCESS_INPUTS; - String processId = getGuid(processVertex); - String processEdgeLabel = getLabel(processId,edgeLabel); - boolean processLabelPairAlreadyProcessed = RequestContext.get().isEdgeLabelAlreadyProcessed(processEdgeLabel); + AtlasVertex processVertex = atlasEdge.getOutVertex(); + String processId = getGuid(processVertex); + String edgeLabel = isOutputEdge ? PROCESS_OUTPUTS : PROCESS_INPUTS; + String processEdgeLabel = getLabel(processId, edgeLabel); + boolean processLabelPairAlreadyProcessed = RequestContext.get().isEdgeLabelAlreadyProcessed(processEdgeLabel); - if (processLabelPairAlreadyProcessed) { - continue; - } - RequestContext.get().addEdgeLabel(processEdgeLabel); + if (processLabelPairAlreadyProcessed) { + continue; + } + RequestContext.get().addEdgeLabel(processEdgeLabel); + + if (getStatus(processVertex) == ACTIVE && !processVertex.equals(deletedVertex)) { Iterator edgeIterator = GraphHelper.getActiveEdges(processVertex, edgeLabel, AtlasEdgeDirection.BOTH); boolean activeEdgeFound = false; From 6a68c4f9c466597b4abab8d633639bd70d3a587d Mon Sep 17 00:00:00 2001 From: aarshi Date: Wed, 23 Oct 2024 14:28:45 +0530 Subject: [PATCH 13/13] skip computation for corrupted vertex --- .../repository/store/graph/v2/EntityGraphRetriever.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java index f64b6c346a..5fbd352be2 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java @@ -1688,8 +1688,9 @@ private AtlasStruct mapVertexToStruct(AtlasVertex entityVertex, String edgeLabel String typeName = getTypeName(referenceVertex); if (StringUtils.isEmpty(typeName)) { - LOG.error("typeName not found for vertex {}", getGuid(referenceVertex) ); - throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_NOT_FOUND, typeName); + LOG.error("typeName not found for in-vertex {} on edge {} from vertex {} ", + getGuid(referenceVertex), edge.getId(), getGuid(entityVertex)); + return ret; } ret = new AtlasStruct(typeName);