You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2020/03/31 21:39:28 UTC
[atlas] branch branch-2.0 updated: ATLAS-3701: performance
improvements in classification-dissociation
This is an automated email from the ASF dual-hosted git repository.
madhan pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 1c38f71 ATLAS-3701: performance improvements in classification-dissociation
1c38f71 is described below
commit 1c38f71a6b8090e7ba0b368aa826201bf8e01d2a
Author: Nikhil Bonte <ni...@freestoneinfotech.com>
AuthorDate: Sat Mar 28 02:24:17 2020 +0530
ATLAS-3701: performance improvements in classification-dissociation
Signed-off-by: Madhan Neethiraj <ma...@apache.org>
(cherry picked from commit 36956bc0c4747c93d1b0c6e234168f18bdbaebb2)
---
.../store/graph/v2/EntityGraphMapper.java | 50 +++++++++-------------
1 file changed, 21 insertions(+), 29 deletions(-)
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java
index b983af3..7653e2f 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java
@@ -2014,6 +2014,12 @@ public class EntityGraphMapper {
throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, entityGuid);
}
+ AtlasPerfTracer perf = null;
+
+ if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
+ perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityGraphMapper.deleteClassification");
+ }
+
List<String> traitNames = getTraitNames(entityVertex);
if (CollectionUtils.isEmpty(traitNames)) {
@@ -2022,8 +2028,6 @@ public class EntityGraphMapper {
validateClassificationExists(traitNames, classificationName);
- Map<AtlasVertex, List<AtlasClassification>> removedClassifications = new HashMap<>();
-
AtlasVertex classificationVertex = getClassificationVertex(entityVertex, classificationName);
AtlasClassification classification = entityRetriever.toAtlasClassification(classificationVertex);
@@ -2032,36 +2036,23 @@ public class EntityGraphMapper {
}
// remove classification from propagated entities if propagation is turned on
- if (isPropagationEnabled(classificationVertex)) {
- List<AtlasVertex> propagatedEntityVertices = deleteDelegate.getHandler().removeTagPropagation(classificationVertex);
-
- // add propagated entities and deleted classification details to removeClassifications map
- if (CollectionUtils.isNotEmpty(propagatedEntityVertices)) {
- for (AtlasVertex propagatedEntityVertex : propagatedEntityVertices) {
- List<AtlasClassification> classifications = removedClassifications.get(propagatedEntityVertex);
-
- if (classifications == null) {
- classifications = new ArrayList<>();
+ final List<AtlasVertex> entityVertices;
- removedClassifications.put(propagatedEntityVertex, classifications);
- }
+ if (isPropagationEnabled(classificationVertex)) {
+ entityVertices = deleteDelegate.getHandler().removeTagPropagation(classificationVertex);
- classifications.add(classification);
- }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Number of propagations to delete -> {}", entityVertices.size());
}
+ } else {
+ entityVertices = new ArrayList<>();
}
- // add associated entity and deleted classification details to removeClassifications map
- List<AtlasClassification> classifications = removedClassifications.get(entityVertex);
-
- if (classifications == null) {
- classifications = new ArrayList<>();
-
- removedClassifications.put(entityVertex, classifications);
+ // add associated entity to entityVertices list
+ if (!entityVertices.contains(entityVertex)) {
+ entityVertices.add(entityVertex);
}
- classifications.add(classification);
-
// remove classifications from associated entity
if (LOG.isDebugEnabled()) {
LOG.debug("Removing classification: [{}] from: [{}][{}] with edge label: [{}]", classificationName,
@@ -2078,12 +2069,13 @@ public class EntityGraphMapper {
updateModificationMetadata(entityVertex);
- for (Map.Entry<AtlasVertex, List<AtlasClassification>> entry : removedClassifications.entrySet()) {
- AtlasEntity entity = updateClassificationText(entry.getKey());
+ if (CollectionUtils.isNotEmpty(entityVertices)) {
+ List<AtlasEntity> propagatedEntities = updateClassificationText(classification, entityVertices);
- List<AtlasClassification> deletedClassificationNames = entry.getValue();
- entityChangeNotifier.onClassificationDeletedFromEntity(entity, deletedClassificationNames);
+ //Sending audit request for all entities at once
+ entityChangeNotifier.onClassificationsDeletedFromEntities(propagatedEntities, Collections.singletonList(classification));
}
+ AtlasPerfTracer.log(perf);
}
private AtlasEntity updateClassificationText(AtlasVertex vertex) throws AtlasBaseException {