Commit fe1c299c by Madhan Neethiraj

ATLAS-3053: updated notification processing to propagate classifications only when specified

parent ee99930f
...@@ -1379,6 +1379,8 @@ public class EntityGraphMapper { ...@@ -1379,6 +1379,8 @@ public class EntityGraphMapper {
public void addClassifications(final EntityMutationContext context, String guid, List<AtlasClassification> classifications) throws AtlasBaseException { public void addClassifications(final EntityMutationContext context, String guid, List<AtlasClassification> classifications) throws AtlasBaseException {
if (CollectionUtils.isNotEmpty(classifications)) { if (CollectionUtils.isNotEmpty(classifications)) {
MetricRecorder metric = RequestContext.get().startMetricRecord("addClassifications");
final AtlasVertex entityVertex = context.getVertex(guid); final AtlasVertex entityVertex = context.getVertex(guid);
final AtlasEntityType entityType = context.getType(guid); final AtlasEntityType entityType = context.getType(guid);
List<AtlasVertex> entitiesToPropagateTo = null; List<AtlasVertex> entitiesToPropagateTo = null;
...@@ -1398,7 +1400,9 @@ public class EntityGraphMapper { ...@@ -1398,7 +1400,9 @@ public class EntityGraphMapper {
} }
if (propagateTags == null) { if (propagateTags == null) {
if(RequestContext.get().isImportInProgress()) { RequestContext reqContext = RequestContext.get();
if(reqContext.isImportInProgress() || reqContext.isInNotificationProcessing()) {
propagateTags = false; propagateTags = false;
classification.setPropagate(propagateTags); classification.setPropagate(propagateTags);
} else { } else {
...@@ -1497,6 +1501,8 @@ public class EntityGraphMapper { ...@@ -1497,6 +1501,8 @@ public class EntityGraphMapper {
entityChangeNotifier.onClassificationAddedToEntity(entity, addedClassifications); entityChangeNotifier.onClassificationAddedToEntity(entity, addedClassifications);
} }
} }
RequestContext.get().endMetricRecord(metric);
} }
} }
......
...@@ -55,6 +55,7 @@ public class RequestContext { ...@@ -55,6 +55,7 @@ public class RequestContext {
private int maxAttempts = 1; private int maxAttempts = 1;
private int attemptCount = 1; private int attemptCount = 1;
private boolean isImportInProgress = false; private boolean isImportInProgress = false;
private boolean isInNotificationProcessing = false;
private RequestContext() { private RequestContext() {
...@@ -164,6 +165,15 @@ public class RequestContext { ...@@ -164,6 +165,15 @@ public class RequestContext {
isImportInProgress = importInProgress; isImportInProgress = importInProgress;
} }
public boolean isInNotificationProcessing() {
return isInNotificationProcessing;
}
public void setInNotificationProcessing(boolean inNotificationProcessing) {
isInNotificationProcessing = inNotificationProcessing;
}
public void recordEntityUpdate(AtlasEntityHeader entity) { public void recordEntityUpdate(AtlasEntityHeader entity) {
if (entity != null && entity.getGuid() != null) { if (entity != null && entity.getGuid() != null) {
updatedEntities.put(entity.getGuid(), entity); updatedEntities.put(entity.getGuid(), entity);
......
...@@ -487,6 +487,7 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl ...@@ -487,6 +487,7 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl
requestContext.setMaxAttempts(maxRetries); requestContext.setMaxAttempts(maxRetries);
requestContext.setUser(messageUser, null); requestContext.setUser(messageUser, null);
requestContext.setInNotificationProcessing(true);
switch (message.getType()) { switch (message.getType()) {
case ENTITY_CREATE: { case ENTITY_CREATE: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment