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/03/13 19:30:09 UTC
[atlas] branch branch-1.0 updated: ATLAS-3069: avoid repeated
warnings of missing relationship-def
This is an automated email from the ASF dual-hosted git repository.
madhan pushed a commit to branch branch-1.0
in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/branch-1.0 by this push:
new 6c9dcc9 ATLAS-3069: avoid repeated warnings of missing relationship-def
6c9dcc9 is described below
commit 6c9dcc9d563102175048528643d4249cfa92380a
Author: Sridhar Swamy <sr...@cloudera.com>
AuthorDate: Fri Mar 8 15:35:49 2019 -0800
ATLAS-3069: avoid repeated warnings of missing relationship-def
Signed-off-by: Madhan Neethiraj <ma...@apache.org>
(cherry picked from commit ca22400ebf425088097b20b33873c15a71d5f908)
---
.../java/org/apache/atlas/type/AtlasEntityType.java | 3 +--
.../org/apache/atlas/type/AtlasTypeRegistry.java | 21 +++++++++++++++++----
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasEntityType.java b/intg/src/main/java/org/apache/atlas/type/AtlasEntityType.java
index b5360c1..87a327a 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasEntityType.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasEntityType.java
@@ -182,8 +182,7 @@ public class AtlasEntityType extends AtlasStructType {
// validate if RelationshipDefs is defined for all entityDefs
if (attributeEntityType != null && !hasRelationshipAttribute(attributeName)) {
- LOG.warn("No RelationshipDef defined between {} and {} on attribute: {}.{}", getTypeName(),
- attributeEntityType.getTypeName(), getTypeName(), attributeName);
+ typeRegistry.reportMissingRelationshipDef(getTypeName(), attributeEntityType.getTypeName(), attributeName);
}
}
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java b/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
index 21f9429..db63ed1 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
@@ -56,16 +56,20 @@ public class AtlasTypeRegistry {
protected RegistryData registryData;
private final TypeRegistryUpdateSynchronizer updateSynchronizer;
+ private final Set<String> missingRelationshipDefs;
+
public AtlasTypeRegistry() {
- registryData = new RegistryData();
- updateSynchronizer = new TypeRegistryUpdateSynchronizer(this);
+ registryData = new RegistryData();
+ updateSynchronizer = new TypeRegistryUpdateSynchronizer(this);
+ missingRelationshipDefs = new HashSet<>();
}
// used only by AtlasTransientTypeRegistry
protected AtlasTypeRegistry(AtlasTypeRegistry other) {
- registryData = new RegistryData();
- updateSynchronizer = other.updateSynchronizer;
+ registryData = new RegistryData();
+ updateSynchronizer = other.updateSynchronizer;
+ missingRelationshipDefs = other.missingRelationshipDefs;
}
public Collection<String> getAllTypeNames() { return registryData.allTypes.getAllTypeNames(); }
@@ -224,6 +228,15 @@ public class AtlasTypeRegistry {
updateSynchronizer.releaseTypeRegistryForUpdate(transientTypeRegistry, commitUpdates);
}
+ public void reportMissingRelationshipDef(String entityType1, String entityType2, String attributeName) {
+ String key = entityType1 + "->" + entityType2 + ":" + attributeName;
+
+ if (!missingRelationshipDefs.contains(key)) {
+ LOG.warn("No RelationshipDef defined between {} and {} on attribute: {}.{}", entityType1, entityType2, entityType1, attributeName);
+
+ missingRelationshipDefs.add(key);
+ }
+ }
static class RegistryData {
final TypeCache allTypes;