[atlas] branch branch-2.0 updated: ATLAS-3091: AtlasGraphProvider Support for Graph with Batch-loading Enable
This is an automated email from the ASF dual-hosted git repository. sarath pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/atlas.git The following commit(s) were added to refs/heads/branch-2.0 by this push: new 132b9e4 ATLAS-3091: AtlasGraphProvider Support for Graph with Batch-loading Enable 132b9e4 is described below commit 132b9e4072fe68829acbeb77868f91770fe097f9 Author: Ashutosh Mestry AuthorDate: Sun Apr 7 23:39:00 2019 -0700 ATLAS-3091: AtlasGraphProvider Support for Graph with Batch-loading Enable (cherry picked from commit f029a4e024aab36cac60f32c75079357376918ef) --- .../atlas/repository/graphdb/GraphDatabase.java| 5 .../repository/graphdb/janus/AtlasJanusGraph.java | 9 +-- .../graphdb/janus/AtlasJanusGraphDatabase.java | 5 .../atlas/repository/graph/AtlasGraphProvider.java | 14 ++ .../repository/graph/IAtlasGraphProvider.java | 2 ++ .../store/graph/v2/BulkLoadingTest.java} | 30 ++ 6 files changed, 53 insertions(+), 12 deletions(-) diff --git a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/GraphDatabase.java b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/GraphDatabase.java index 3dfc6e8..83f57d1 100644 --- a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/GraphDatabase.java +++ b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/GraphDatabase.java @@ -37,6 +37,11 @@ public interface GraphDatabase { */ AtlasGraph getGraph(); +/* + * Get graph initialized for bulk loading. This instance is used for high-performance ingest. + */ +AtlasGraph getGraphBulkLoading(); + /** * Sets things up so that getGraph() will return a graph that can be used for running * tests. diff --git a/graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasJanusGraph.java b/graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasJanusGraph.java index 8eea96b..840ebca 100644 --- a/graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasJanusGraph.java +++ b/graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasJanusGraph.java @@ -78,6 +78,7 @@ import java.util.stream.StreamSupport; import static org.apache.atlas.repository.Constants.INDEX_SEARCH_VERTEX_PREFIX_DEFAULT; import static org.apache.atlas.repository.Constants.INDEX_SEARCH_VERTEX_PREFIX_PROPERTY; +import static org.apache.atlas.repository.graphdb.janus.AtlasJanusGraphDatabase.getGraphInstance; /** * Janus implementation of AtlasGraph. @@ -91,11 +92,15 @@ public class AtlasJanusGraph implements AtlasGraph keys = mgmt.getRelationTypes(PropertyKey.class); @@ -278,7 +283,7 @@ public class AtlasJanusGraph implements AtlasGraph getGraphBulkLoading() { +return new AtlasJanusGraph(getBulkLoadingGraphInstance()); +} + private static void startLocalSolr() { if (isEmbeddedSolr()) { try { diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/AtlasGraphProvider.java b/repository/src/main/java/org/apache/atlas/repository/graph/AtlasGraphProvider.java index 5aa8033..dfe4b25 100755 --- a/repository/src/main/java/org/apache/atlas/repository/graph/AtlasGraphProvider.java +++ b/repository/src/main/java/org/apache/atlas/repository/graph/AtlasGraphProvider.java @@ -72,6 +72,20 @@ public class AtlasGraphProvider implements IAtlasGraphProvider { } } +public AtlasGraph getBulkLoading() { +try { +GraphDatabase graphDB = null; +synchronized (AtlasGraphProvider.class) { +Class implClass = AtlasRepositoryConfiguration.getGraphDatabaseImpl(); +graphDB = (GraphDatabase) implClass.newInstance(); +} + +return graphDB.getGraphBulkLoading(); +} catch (IllegalAccessException | InstantiationException e) { +throw new RuntimeException("Error initializing graph database", e); +} +} + @VisibleForTesting public static void cleanup() { getGraphDatabase().cleanup(); diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/IAtlasGraphProvider.java b/repository/src/main/java/org/apache/atlas/repository/graph/IAtlasGraphProvider.java index a2cac2d..29add20 100755 --- a/repository/src/main/java/org/apache/atlas/repository/graph/IAtlasGraphProvider.java +++ b/repository/src/main/java/org/apache/atlas/repository/graph/IAtlasGraphProvider.java @@ -29,4 +29,6 @@ import org.apache.atlas.repository.graphdb.AtlasGraph; public interface IAtlasGraphProvider { AtlasGraph get() throws RepositoryException; + +AtlasGraph getBulkLoading() throws RepositoryException; } diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/IAtlasGraphProvider.java
[atlas] branch master updated: ATLAS-3091: AtlasGraphProvider Support for Graph with Batch-loading Enable
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 The following commit(s) were added to refs/heads/master by this push: new f029a4e ATLAS-3091: AtlasGraphProvider Support for Graph with Batch-loading Enable f029a4e is described below commit f029a4e024aab36cac60f32c75079357376918ef Author: Ashutosh Mestry AuthorDate: Sun Apr 7 23:39:00 2019 -0700 ATLAS-3091: AtlasGraphProvider Support for Graph with Batch-loading Enable --- .../atlas/repository/graphdb/GraphDatabase.java| 5 .../repository/graphdb/janus/AtlasJanusGraph.java | 9 +-- .../graphdb/janus/AtlasJanusGraphDatabase.java | 5 .../atlas/repository/graph/AtlasGraphProvider.java | 14 ++ .../repository/graph/IAtlasGraphProvider.java | 2 ++ .../store/graph/v2/BulkLoadingTest.java} | 30 ++ 6 files changed, 53 insertions(+), 12 deletions(-) diff --git a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/GraphDatabase.java b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/GraphDatabase.java index 3dfc6e8..83f57d1 100644 --- a/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/GraphDatabase.java +++ b/graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/GraphDatabase.java @@ -37,6 +37,11 @@ public interface GraphDatabase { */ AtlasGraph getGraph(); +/* + * Get graph initialized for bulk loading. This instance is used for high-performance ingest. + */ +AtlasGraph getGraphBulkLoading(); + /** * Sets things up so that getGraph() will return a graph that can be used for running * tests. diff --git a/graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasJanusGraph.java b/graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasJanusGraph.java index 8eea96b..840ebca 100644 --- a/graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasJanusGraph.java +++ b/graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasJanusGraph.java @@ -78,6 +78,7 @@ import java.util.stream.StreamSupport; import static org.apache.atlas.repository.Constants.INDEX_SEARCH_VERTEX_PREFIX_DEFAULT; import static org.apache.atlas.repository.Constants.INDEX_SEARCH_VERTEX_PREFIX_PROPERTY; +import static org.apache.atlas.repository.graphdb.janus.AtlasJanusGraphDatabase.getGraphInstance; /** * Janus implementation of AtlasGraph. @@ -91,11 +92,15 @@ public class AtlasJanusGraph implements AtlasGraph keys = mgmt.getRelationTypes(PropertyKey.class); @@ -278,7 +283,7 @@ public class AtlasJanusGraph implements AtlasGraph getGraphBulkLoading() { +return new AtlasJanusGraph(getBulkLoadingGraphInstance()); +} + private static void startLocalSolr() { if (isEmbeddedSolr()) { try { diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/AtlasGraphProvider.java b/repository/src/main/java/org/apache/atlas/repository/graph/AtlasGraphProvider.java index 5aa8033..dfe4b25 100755 --- a/repository/src/main/java/org/apache/atlas/repository/graph/AtlasGraphProvider.java +++ b/repository/src/main/java/org/apache/atlas/repository/graph/AtlasGraphProvider.java @@ -72,6 +72,20 @@ public class AtlasGraphProvider implements IAtlasGraphProvider { } } +public AtlasGraph getBulkLoading() { +try { +GraphDatabase graphDB = null; +synchronized (AtlasGraphProvider.class) { +Class implClass = AtlasRepositoryConfiguration.getGraphDatabaseImpl(); +graphDB = (GraphDatabase) implClass.newInstance(); +} + +return graphDB.getGraphBulkLoading(); +} catch (IllegalAccessException | InstantiationException e) { +throw new RuntimeException("Error initializing graph database", e); +} +} + @VisibleForTesting public static void cleanup() { getGraphDatabase().cleanup(); diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/IAtlasGraphProvider.java b/repository/src/main/java/org/apache/atlas/repository/graph/IAtlasGraphProvider.java index a2cac2d..29add20 100755 --- a/repository/src/main/java/org/apache/atlas/repository/graph/IAtlasGraphProvider.java +++ b/repository/src/main/java/org/apache/atlas/repository/graph/IAtlasGraphProvider.java @@ -29,4 +29,6 @@ import org.apache.atlas.repository.graphdb.AtlasGraph; public interface IAtlasGraphProvider { AtlasGraph get() throws RepositoryException; + +AtlasGraph getBulkLoading() throws RepositoryException; } diff --git a/repository/src/main/java/org/apache/atlas/repository/graph/IAtlasGraphProvider.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/v2/BulkLoadingTest.java old mode 100755 new mode 100644 similarity index 56%