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 2019/02/20 22:49:04 UTC
[atlas] branch master updated: ATLAS-3053: updated notification
processing to propagate classifications only when specified
This is an automated email from the ASF dual-hosted git repository.
madhan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/master by this push:
new fe1c299 ATLAS-3053: updated notification processing to propagate classifications only when specified
fe1c299 is described below
commit fe1c299ce4387138ec82b0824415949daa93fa6f
Author: Madhan Neethiraj <ma...@apache.org>
AuthorDate: Wed Feb 13 16:05:38 2019 -0800
ATLAS-3053: updated notification processing to propagate classifications only when specified
---
.../atlas/repository/store/graph/v2/EntityGraphMapper.java | 8 +++++++-
server-api/src/main/java/org/apache/atlas/RequestContext.java | 10 ++++++++++
.../apache/atlas/notification/NotificationHookConsumer.java | 1 +
3 files changed, 18 insertions(+), 1 deletion(-)
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 a260154..173fe02 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
@@ -1379,6 +1379,8 @@ public class EntityGraphMapper {
public void addClassifications(final EntityMutationContext context, String guid, List<AtlasClassification> classifications) throws AtlasBaseException {
if (CollectionUtils.isNotEmpty(classifications)) {
+ MetricRecorder metric = RequestContext.get().startMetricRecord("addClassifications");
+
final AtlasVertex entityVertex = context.getVertex(guid);
final AtlasEntityType entityType = context.getType(guid);
List<AtlasVertex> entitiesToPropagateTo = null;
@@ -1398,7 +1400,9 @@ public class EntityGraphMapper {
}
if (propagateTags == null) {
- if(RequestContext.get().isImportInProgress()) {
+ RequestContext reqContext = RequestContext.get();
+
+ if(reqContext.isImportInProgress() || reqContext.isInNotificationProcessing()) {
propagateTags = false;
classification.setPropagate(propagateTags);
} else {
@@ -1497,6 +1501,8 @@ public class EntityGraphMapper {
entityChangeNotifier.onClassificationAddedToEntity(entity, addedClassifications);
}
}
+
+ RequestContext.get().endMetricRecord(metric);
}
}
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 f127424..18a1b7b 100644
--- a/server-api/src/main/java/org/apache/atlas/RequestContext.java
+++ b/server-api/src/main/java/org/apache/atlas/RequestContext.java
@@ -55,6 +55,7 @@ public class RequestContext {
private int maxAttempts = 1;
private int attemptCount = 1;
private boolean isImportInProgress = false;
+ private boolean isInNotificationProcessing = false;
private RequestContext() {
@@ -164,6 +165,15 @@ public class RequestContext {
isImportInProgress = importInProgress;
}
+ public boolean isInNotificationProcessing() {
+ return isInNotificationProcessing;
+ }
+
+ public void setInNotificationProcessing(boolean inNotificationProcessing) {
+ isInNotificationProcessing = inNotificationProcessing;
+ }
+
+
public void recordEntityUpdate(AtlasEntityHeader entity) {
if (entity != null && entity.getGuid() != null) {
updatedEntities.put(entity.getGuid(), entity);
diff --git a/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java b/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java
index bd54770..f829260 100644
--- a/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java
+++ b/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java
@@ -487,6 +487,7 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
requestContext.setMaxAttempts(maxRetries);
requestContext.setUser(messageUser, null);
+ requestContext.setInNotificationProcessing(true);
switch (message.getType()) {
case ENTITY_CREATE: {