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/02/22 06:23:09 UTC

[atlas] branch branch-0.8 updated: ATLAS-3621: updated HiveHook to not save query-string in multiple attributes - queryText and name - #2 (avoid excessive logs)

This is an automated email from the ASF dual-hosted git repository.

madhan pushed a commit to branch branch-0.8
in repository https://gitbox.apache.org/repos/asf/atlas.git


The following commit(s) were added to refs/heads/branch-0.8 by this push:
     new 4ba5502  ATLAS-3621: updated HiveHook to not save query-string in multiple attributes - queryText and name - #2 (avoid excessive logs)
4ba5502 is described below

commit 4ba5502217c9cd6e023b1b31e24edd1e67e924da
Author: Madhan Neethiraj <ma...@apache.org>
AuthorDate: Fri Feb 21 16:42:25 2020 -0800

    ATLAS-3621: updated HiveHook to not save query-string in multiple attributes - queryText and name - #2 (avoid excessive logs)
    
    (cherry picked from commit 6eb72fa456e527baeb144245421e29bffa98592b)
---
 .../atlas/notification/preprocessor/HivePreprocessor.java    | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/webapp/src/main/java/org/apache/atlas/notification/preprocessor/HivePreprocessor.java b/webapp/src/main/java/org/apache/atlas/notification/preprocessor/HivePreprocessor.java
index a3433cc..56575d0 100644
--- a/webapp/src/main/java/org/apache/atlas/notification/preprocessor/HivePreprocessor.java
+++ b/webapp/src/main/java/org/apache/atlas/notification/preprocessor/HivePreprocessor.java
@@ -27,6 +27,7 @@ import org.slf4j.LoggerFactory;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.Objects;
 
 public class HivePreprocessor {
     private static final Logger LOG = LoggerFactory.getLogger(HivePreprocessor.class);
@@ -156,11 +157,14 @@ public class HivePreprocessor {
         @Override
         public void preprocess(AtlasEntity entity, PreprocessorContext context) {
             if (context.updateHiveProcessNameWithQualifiedName()) {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("setting {}.name={}. topic-offset={}, partition={}", entity.getTypeName(), entity.getAttribute(ATTRIBUTE_QUALIFIED_NAME), context.getKafkaMessageOffset(), context.getKafkaPartition());
-                }
+                Object name          = entity.getAttribute(ATTRIBUTE_NAME);
+                Object qualifiedName = entity.getAttribute(ATTRIBUTE_QUALIFIED_NAME);
+
+                if (!Objects.equals(name, qualifiedName)) {
+                    LOG.info("setting {}.name={}. topic-offset={}, partition={}", entity.getTypeName(), qualifiedName, context.getKafkaMessageOffset(), context.getKafkaPartition());
 
-                entity.setAttribute(ATTRIBUTE_NAME, entity.getAttribute(ATTRIBUTE_QUALIFIED_NAME));
+                    entity.setAttribute(ATTRIBUTE_NAME, qualifiedName);
+                }
             }
 
             if (context.isIgnoredEntity(entity.getGuid())) {