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/09/14 16:42:30 UTC

[atlas] 02/02: ATLAS-3368: log warning for references without relationship-def

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

commit 7a472f704719f0ab762b556f8b701ab4951d38b1
Author: Bolke de Bruin <bo...@xs4all.nl>
AuthorDate: Tue Aug 13 13:35:28 2019 +0200

    ATLAS-3368: log warning for references without relationship-def
    
    Signed-off-by: Madhan Neethiraj <ma...@apache.org>
    (cherry picked from commit 3eadf7e875f810713b3a11a8e49ab2054128ac93)
---
 docs/src/site/twiki/Configuration.twiki                            | 4 ++++
 intg/src/main/java/org/apache/atlas/AtlasConfiguration.java        | 2 ++
 .../apache/atlas/repository/store/graph/v2/EntityGraphMapper.java  | 7 ++++---
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/docs/src/site/twiki/Configuration.twiki b/docs/src/site/twiki/Configuration.twiki
index 6190a7c..41e5c27 100644
--- a/docs/src/site/twiki/Configuration.twiki
+++ b/docs/src/site/twiki/Configuration.twiki
@@ -186,6 +186,10 @@ atlas.webserver.keepalivetimesecs=60
 
 # Queue size for the requests(when max threads are busy) for the atlas web server
 atlas.webserver.queuesize=100
+
+# Set to the property to true to enable warn on no relationships defined between entities on a particular attribute
+# Not having relationships defined can lead to performance loss while adding new entities
+atlas.relationships.warnOnNoRelationships=false
 </verbatim>
 
 ---+++ Recording performance metrics
diff --git a/intg/src/main/java/org/apache/atlas/AtlasConfiguration.java b/intg/src/main/java/org/apache/atlas/AtlasConfiguration.java
index 7b71e51..38087dc 100644
--- a/intg/src/main/java/org/apache/atlas/AtlasConfiguration.java
+++ b/intg/src/main/java/org/apache/atlas/AtlasConfiguration.java
@@ -53,6 +53,8 @@ public enum AtlasConfiguration {
 
     GRAPHSTORE_INDEXED_STRING_SAFE_LENGTH("atlas.graphstore.indexed.string.safe.length", Short.MAX_VALUE),  // based on org.apache.hadoop.hbase.client.Mutation.checkRow()
 
+    RELATIONSHIP_WARN_NO_RELATIONSHIPS("atlas.relationships.warnOnNoRelationships", false),
+
     //search configuration
     SEARCH_MAX_LIMIT("atlas.search.maxlimit", 10000),
     SEARCH_DEFAULT_LIMIT("atlas.search.defaultlimit", 100);
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 c02f809..db65863 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
@@ -110,6 +110,7 @@ public class EntityGraphMapper {
 
     private static final String SOFT_REF_FORMAT               = "%s:%s";
     private static final int INDEXED_STR_SAFE_LEN             = AtlasConfiguration.GRAPHSTORE_INDEXED_STRING_SAFE_LENGTH.getInt();
+    private static final boolean WARN_ON_NO_RELATIONSHIP       = AtlasConfiguration.RELATIONSHIP_WARN_NO_RELATIONSHIPS.getBoolean();
     private static final String CLASSIFICATION_NAME_DELIMITER = "|";
 
     private final GraphHelper               graphHelper = GraphHelper.getInstance();
@@ -948,9 +949,9 @@ public class EntityGraphMapper {
                 }
             } else {
                 // use legacy way to create/update edges
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("No RelationshipDef defined between {} and {} on attribute: {}",  getTypeName(entityVertex),
-                               getTypeName(attributeVertex), attributeName);
+                if (WARN_ON_NO_RELATIONSHIP || LOG.isDebugEnabled()) {
+                    LOG.warn("No RelationshipDef defined between {} and {} on attribute: {}. This can lead to severe performance degradation.",
+                             getTypeName(entityVertex), getTypeName(attributeVertex), attributeName);
                 }
 
                 ret = mapObjectIdValue(ctx, context);