Skip to content

Commit

Permalink
Merge pull request #3700 from atlanhq/master-beta-sync
Browse files Browse the repository at this point in the history
Master to Beta Sync
  • Loading branch information
hr2904 authored Nov 7, 2024
2 parents 8688a45 + adfa649 commit 8fefdff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 34 deletions.
2 changes: 1 addition & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3244,35 +3244,6 @@ public void cleanUpClassificationPropagation(String classificationName, int batc
LOG.info("Completed cleaning up classification {}", classificationName);
}

private void detachAndRepairTagEdges(String classificationName, AtlasVertex vertex){
LOG.info("{} - detachAndRepairTagEdges started with index-> {}, processed by thread -> {}", classificationName, Thread.currentThread().getName());
List<AtlasClassification> deletedClassifications = new ArrayList<>();
List<AtlasEdge> classificationEdges = GraphHelper.getClassificationEdges(vertex, null, classificationName);
try{
for (AtlasEdge edge : classificationEdges) {
AtlasClassification classification = entityRetriever.toAtlasClassification(edge.getInVertex());
deletedClassifications.add(classification);
graph.removeEdge(edge);
}

AtlasEntity entity = repairClassificationMappings(vertex);

entityChangeNotifier.onClassificationDeletedFromEntity(entity, deletedClassifications);
transactionInterceptHelper.intercept();
}
catch (AtlasBaseException e){
LOG.error("Encountered some problem in detaching and repairing tag edges for Asset Vertex : {}", vertex.getIdForDisplay());
e.printStackTrace();
}
catch (Exception e){
LOG.error("Encountered some unknown problem in detaching and repairing tag edges for Asset Vertex : {}", vertex.getIdForDisplay());
e.printStackTrace();
}
finally {
LOG.info("{} - detachAndRepairTagEdges ended with index-> {}, processed by thread -> {}", classificationName, Thread.currentThread().getName());
}
}

public AtlasEntity repairClassificationMappings(AtlasVertex entityVertex) throws AtlasBaseException {
String guid = GraphHelper.getGuid(entityVertex);
AtlasEntity entity = instanceConverter.getEntity(guid, ENTITY_CHANGE_NOTIFY_IGNORE_RELATIONSHIP_ATTRIBUTES);
Expand Down Expand Up @@ -3628,6 +3599,10 @@ public void deleteClassification(String entityGuid, String classificationName) t

AtlasVertex classificationVertex = getClassificationVertex(graphHelper, entityVertex, classificationName);

if (Objects.isNull(classificationVertex)) {
LOG.error(AtlasErrorCode.CLASSIFICATION_NOT_FOUND.getFormattedErrorMessage(classificationName));
return;
}
// Get in progress task to see if there already is a propagation for this particular vertex
List<AtlasTask> inProgressTasks = taskManagement.getInProgressTasks();
for (AtlasTask task : inProgressTasks) {
Expand All @@ -3639,7 +3614,8 @@ public void deleteClassification(String entityGuid, String classificationName) t
AtlasClassification classification = entityRetriever.toAtlasClassification(classificationVertex);

if (classification == null) {
throw new AtlasBaseException(AtlasErrorCode.CLASSIFICATION_NOT_FOUND, classificationName);
LOG.error(AtlasErrorCode.CLASSIFICATION_NOT_FOUND.getFormattedErrorMessage(classificationName));
return;
}

// remove classification from propagated entities if propagation is turned on
Expand Down Expand Up @@ -4028,9 +4004,10 @@ public void updateClassifications(EntityMutationContext context, String guid, Li

AtlasVertex classificationVertex = getClassificationVertex(graphHelper, entityVertex, classificationName);

if (classificationVertex == null) {
throw new AtlasBaseException(AtlasErrorCode.CLASSIFICATION_NOT_ASSOCIATED_WITH_ENTITY, classificationName);
}
if (classificationVertex == null) {
LOG.error(AtlasErrorCode.CLASSIFICATION_NOT_FOUND.getFormattedErrorMessage(classificationName));
continue;
}

if (LOG.isDebugEnabled()) {
LOG.debug("Updating classification {} for entity {}", classification, guid);
Expand Down

0 comments on commit 8fefdff

Please sign in to comment.