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 {
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);
}
}
......
......@@ -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);
......
......@@ -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: {
......
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