Commit ca22400e by Sridhar Swamy Committed by Madhan Neethiraj

ATLAS-3069: avoid repeated warnings of missing relationship-def

parent 3ed1f5a0
......@@ -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);
}
}
......
......@@ -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;
......
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