You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by sv...@apache.org on 2017/01/12 08:03:01 UTC

incubator-atlas git commit: GET v2/types/{type}/guid/{guid} not working

Repository: incubator-atlas
Updated Branches:
  refs/heads/master 9683c1170 -> b725caaa8


GET v2/types/{type}/guid/{guid} not working


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/b725caaa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/b725caaa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/b725caaa

Branch: refs/heads/master
Commit: b725caaa879240f3012e85bf888072a42f2d4308
Parents: 9683c11
Author: Vimal Sharma <sv...@apache.org>
Authored: Thu Jan 12 13:32:26 2017 +0530
Committer: Vimal Sharma <sv...@apache.org>
Committed: Thu Jan 12 13:32:26 2017 +0530

----------------------------------------------------------------------
 .../java/org/apache/atlas/type/AtlasTypeRegistry.java   | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/b725caaa/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
----------------------------------------------------------------------
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 7aa4f29..c88e559 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java
@@ -731,6 +731,7 @@ class TypeCache {
 }
 
 class TypeDefCache<T extends AtlasBaseTypeDef> {
+    private static final Logger LOG = LoggerFactory.getLogger(TypeDefCache.class);
     private final TypeCache      typeCache;
     private final Map<String, T> typeDefGuidMap;
     private final Map<String, T> typeDefNameMap;
@@ -766,7 +767,6 @@ class TypeDefCache<T extends AtlasBaseTypeDef> {
     }
 
     public T getTypeDefByGuid(String guid) {
-
         return guid != null ? typeDefGuidMap.get(guid) : null;
     }
 
@@ -781,8 +781,14 @@ class TypeDefCache<T extends AtlasBaseTypeDef> {
 
             if (typeDef != null) {
                 String currGuid = typeDef.getGuid();
-
-                if (!StringUtils.equals(currGuid, newGuid)) {
+                if (!typeDefGuidMap.containsKey(newGuid) || !StringUtils.equals(currGuid, newGuid)) {
+                    if(LOG.isDebugEnabled()) {
+                        if (!typeDefGuidMap.containsKey(newGuid)) {
+                            LOG.debug("TypeDefGuidMap doesn't contain entry for guid {}. Adding new entry", newGuid);
+                        } else {
+                            LOG.debug("Removing entry for guid {} and adding entry for guid {}", currGuid, newGuid);
+                        }
+                    }
                     if (currGuid != null) {
                         typeDefGuidMap.remove(currGuid);
                     }