You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by am...@apache.org on 2019/07/31 23:10:56 UTC

[atlas] branch master updated (6598c74 -> b518919)

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

amestry pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git.


    from 6598c74  ATLAS-3347: fixed range-validation for primitive attribute types
     new 7b0a0e1  ATLAS-3232: Import Service: Handling RelationshipAttributes during import.
     new b518919  ATLAS-3354: Stale entry in RequestContext causes Export's changeMarker to not be updated.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../atlas/repository/impexp/ImportTypeDefProcessor.java      |  5 +++++
 .../atlas/repository/impexp/TypeAttributeDifference.java     | 12 ++++++++++++
 .../store/bootstrap/AtlasTypeDefStoreInitializer.java        |  3 +++
 3 files changed, 20 insertions(+)


[atlas] 01/02: ATLAS-3232: Import Service: Handling RelationshipAttributes during import.

Posted by am...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

amestry pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git

commit 7b0a0e1294f9ee91e269aa4bd970e54ab42df779
Author: Ashutosh Mestry <am...@hortonworks.com>
AuthorDate: Wed Jul 31 15:59:16 2019 -0700

    ATLAS-3232: Import Service: Handling RelationshipAttributes during import.
---
 .../atlas/repository/impexp/ImportTypeDefProcessor.java      |  5 +++++
 .../atlas/repository/impexp/TypeAttributeDifference.java     | 12 ++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/repository/src/main/java/org/apache/atlas/repository/impexp/ImportTypeDefProcessor.java b/repository/src/main/java/org/apache/atlas/repository/impexp/ImportTypeDefProcessor.java
index c217937..4fc70bc 100644
--- a/repository/src/main/java/org/apache/atlas/repository/impexp/ImportTypeDefProcessor.java
+++ b/repository/src/main/java/org/apache/atlas/repository/impexp/ImportTypeDefProcessor.java
@@ -22,6 +22,7 @@ import org.apache.atlas.model.impexp.AtlasImportResult;
 import org.apache.atlas.model.typedef.AtlasClassificationDef;
 import org.apache.atlas.model.typedef.AtlasEntityDef;
 import org.apache.atlas.model.typedef.AtlasEnumDef;
+import org.apache.atlas.model.typedef.AtlasRelationshipDef;
 import org.apache.atlas.model.typedef.AtlasStructDef;
 import org.apache.atlas.model.typedef.AtlasTypesDef;
 import org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer;
@@ -68,6 +69,10 @@ public class ImportTypeDefProcessor {
         for (AtlasStructDef def : typesDef.getStructDefs()) {
             def.setGuid(null);
         }
+
+        for (AtlasRelationshipDef def : typesDef.getRelationshipDefs()) {
+            def.setGuid(null);
+        }
     }
 
     private void updateMetricsForTypesDef(AtlasTypesDef typeDefinitionMap, AtlasImportResult result) {
diff --git a/repository/src/main/java/org/apache/atlas/repository/impexp/TypeAttributeDifference.java b/repository/src/main/java/org/apache/atlas/repository/impexp/TypeAttributeDifference.java
index e3d86c8..b811b5a 100644
--- a/repository/src/main/java/org/apache/atlas/repository/impexp/TypeAttributeDifference.java
+++ b/repository/src/main/java/org/apache/atlas/repository/impexp/TypeAttributeDifference.java
@@ -24,6 +24,7 @@ import org.apache.atlas.model.impexp.AtlasImportResult;
 import org.apache.atlas.model.typedef.AtlasClassificationDef;
 import org.apache.atlas.model.typedef.AtlasEntityDef;
 import org.apache.atlas.model.typedef.AtlasEnumDef;
+import org.apache.atlas.model.typedef.AtlasRelationshipDef;
 import org.apache.atlas.model.typedef.AtlasStructDef;
 import org.apache.atlas.model.typedef.AtlasTypesDef;
 import org.apache.atlas.store.AtlasTypeDefStore;
@@ -53,6 +54,7 @@ public class TypeAttributeDifference {
         updateClassificationDef(typeDefinitionMap, result);
         updateEnumDef(typeDefinitionMap, result);
         updateStructDef(typeDefinitionMap, result);
+        updateRelationshipDefs(typeDefinitionMap, result);
     }
 
     private void updateEntityDef(AtlasTypesDef typeDefinitionMap, AtlasImportResult result) throws AtlasBaseException {
@@ -95,6 +97,16 @@ public class TypeAttributeDifference {
         }
     }
 
+    private void updateRelationshipDefs(AtlasTypesDef typeDefinitionMap, AtlasImportResult result) throws AtlasBaseException {
+        for (AtlasRelationshipDef def : typeDefinitionMap.getRelationshipDefs()) {
+            AtlasRelationshipDef existing = typeRegistry.getRelationshipDefByName(def.getName());
+            if (existing != null && addAttributes(existing, def)) {
+                typeDefStore.updateRelationshipDefByName(existing.getName(), existing);
+                result.incrementMeticsCounter("typedef:relationshipdef:update");
+            }
+        }
+    }
+
     @VisibleForTesting
     boolean addElements(AtlasEnumDef existing, AtlasEnumDef incoming) throws AtlasBaseException {
         return addElements(existing, getElementsAbsentInExisting(existing, incoming));


[atlas] 02/02: ATLAS-3354: Stale entry in RequestContext causes Export's changeMarker to not be updated.

Posted by am...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

amestry pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git

commit b5189194952c73ce77d4c935b4d00a9a2d16684d
Author: Ashutosh Mestry <am...@hortonworks.com>
AuthorDate: Wed Jul 31 16:05:19 2019 -0700

    ATLAS-3354: Stale entry in RequestContext causes Export's changeMarker to not be updated.
---
 .../atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java b/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java
index de79cbe..8d7dbfb 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/bootstrap/AtlasTypeDefStoreInitializer.java
@@ -360,6 +360,8 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
             }
         } catch (AtlasBaseException e) {
             LOG.error("Failed to init after becoming active", e);
+        } finally {
+            RequestContext.clear();
         }
     }
 
@@ -880,6 +882,7 @@ public class AtlasTypeDefStoreInitializer implements ActiveStateChangeHandler {
                         ret = APPLIED;
                     } finally {
                         RequestContext.get().setInTypePatching(false);
+                        RequestContext.clear();
                     }
                 }
             } else {