Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
f029a4e0
Commit
f029a4e0
authored
Apr 07, 2019
by
Ashutosh Mestry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3091: AtlasGraphProvider Support for Graph with Batch-loading Enable
parent
37eb2765
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
75 additions
and
2 deletions
+75
-2
GraphDatabase.java
...va/org/apache/atlas/repository/graphdb/GraphDatabase.java
+5
-0
AtlasJanusGraph.java
...pache/atlas/repository/graphdb/janus/AtlasJanusGraph.java
+7
-2
AtlasJanusGraphDatabase.java
...las/repository/graphdb/janus/AtlasJanusGraphDatabase.java
+5
-0
AtlasGraphProvider.java
...org/apache/atlas/repository/graph/AtlasGraphProvider.java
+14
-0
IAtlasGraphProvider.java
...rg/apache/atlas/repository/graph/IAtlasGraphProvider.java
+2
-0
BulkLoadingTest.java
...ache/atlas/repository/store/graph/v2/BulkLoadingTest.java
+42
-0
No files found.
graphdb/api/src/main/java/org/apache/atlas/repository/graphdb/GraphDatabase.java
View file @
f029a4e0
...
@@ -37,6 +37,11 @@ public interface GraphDatabase<V, E> {
...
@@ -37,6 +37,11 @@ public interface GraphDatabase<V, E> {
*/
*/
AtlasGraph
<
V
,
E
>
getGraph
();
AtlasGraph
<
V
,
E
>
getGraph
();
/*
* Get graph initialized for bulk loading. This instance is used for high-performance ingest.
*/
AtlasGraph
<
V
,
E
>
getGraphBulkLoading
();
/**
/**
* Sets things up so that getGraph() will return a graph that can be used for running
* Sets things up so that getGraph() will return a graph that can be used for running
* tests.
* tests.
...
...
graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasJanusGraph.java
View file @
f029a4e0
...
@@ -78,6 +78,7 @@ import java.util.stream.StreamSupport;
...
@@ -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_DEFAULT
;
import
static
org
.
apache
.
atlas
.
repository
.
Constants
.
INDEX_SEARCH_VERTEX_PREFIX_PROPERTY
;
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.
* Janus implementation of AtlasGraph.
...
@@ -91,11 +92,15 @@ public class AtlasJanusGraph implements AtlasGraph<AtlasJanusVertex, AtlasJanusE
...
@@ -91,11 +92,15 @@ public class AtlasJanusGraph implements AtlasGraph<AtlasJanusVertex, AtlasJanusE
private
final
StandardJanusGraph
janusGraph
;
private
final
StandardJanusGraph
janusGraph
;
public
AtlasJanusGraph
()
{
public
AtlasJanusGraph
()
{
this
(
getGraphInstance
());
}
public
AtlasJanusGraph
(
JanusGraph
graphInstance
)
{
//determine multi-properties once at startup
//determine multi-properties once at startup
JanusGraphManagement
mgmt
=
null
;
JanusGraphManagement
mgmt
=
null
;
try
{
try
{
mgmt
=
AtlasJanusGraphDatabase
.
getGraphInstance
()
.
openManagement
();
mgmt
=
graphInstance
.
openManagement
();
Iterable
<
PropertyKey
>
keys
=
mgmt
.
getRelationTypes
(
PropertyKey
.
class
);
Iterable
<
PropertyKey
>
keys
=
mgmt
.
getRelationTypes
(
PropertyKey
.
class
);
...
@@ -278,7 +283,7 @@ public class AtlasJanusGraph implements AtlasGraph<AtlasJanusVertex, AtlasJanusE
...
@@ -278,7 +283,7 @@ public class AtlasJanusGraph implements AtlasGraph<AtlasJanusVertex, AtlasJanusE
}
}
private
JanusGraph
getGraph
()
{
private
JanusGraph
getGraph
()
{
return
AtlasJanusGraphDatabase
.
getGraphInstance
();
return
getGraphInstance
();
}
}
@Override
@Override
...
...
graphdb/janus/src/main/java/org/apache/atlas/repository/graphdb/janus/AtlasJanusGraphDatabase.java
View file @
f029a4e0
...
@@ -264,6 +264,11 @@ public class AtlasJanusGraphDatabase implements GraphDatabase<AtlasJanusVertex,
...
@@ -264,6 +264,11 @@ public class AtlasJanusGraphDatabase implements GraphDatabase<AtlasJanusVertex,
return
atlasGraphInstance
;
return
atlasGraphInstance
;
}
}
@Override
public
AtlasGraph
<
AtlasJanusVertex
,
AtlasJanusEdge
>
getGraphBulkLoading
()
{
return
new
AtlasJanusGraph
(
getBulkLoadingGraphInstance
());
}
private
static
void
startLocalSolr
()
{
private
static
void
startLocalSolr
()
{
if
(
isEmbeddedSolr
())
{
if
(
isEmbeddedSolr
())
{
try
{
try
{
...
...
repository/src/main/java/org/apache/atlas/repository/graph/AtlasGraphProvider.java
View file @
f029a4e0
...
@@ -72,6 +72,20 @@ public class AtlasGraphProvider implements IAtlasGraphProvider {
...
@@ -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
@VisibleForTesting
public
static
void
cleanup
()
{
public
static
void
cleanup
()
{
getGraphDatabase
().
cleanup
();
getGraphDatabase
().
cleanup
();
...
...
repository/src/main/java/org/apache/atlas/repository/graph/IAtlasGraphProvider.java
View file @
f029a4e0
...
@@ -29,4 +29,6 @@ import org.apache.atlas.repository.graphdb.AtlasGraph;
...
@@ -29,4 +29,6 @@ import org.apache.atlas.repository.graphdb.AtlasGraph;
public
interface
IAtlasGraphProvider
{
public
interface
IAtlasGraphProvider
{
AtlasGraph
get
()
throws
RepositoryException
;
AtlasGraph
get
()
throws
RepositoryException
;
AtlasGraph
getBulkLoading
()
throws
RepositoryException
;
}
}
repository/src/test/java/org/apache/atlas/repository/store/graph/v2/BulkLoadingTest.java
0 → 100644
View file @
f029a4e0
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
repository
.
store
.
graph
.
v2
;
import
org.apache.atlas.TestModules
;
import
org.apache.atlas.repository.RepositoryException
;
import
org.apache.atlas.repository.graph.AtlasGraphProvider
;
import
org.testng.annotations.Guice
;
import
org.testng.annotations.Test
;
import
javax.inject.Inject
;
import
static
org
.
testng
.
Assert
.
assertNotNull
;
@Guice
(
modules
=
TestModules
.
TestOnlyModule
.
class
)
public
class
BulkLoadingTest
{
@Inject
AtlasGraphProvider
graphProvider
;
@Test
(
expectedExceptions
=
RuntimeException
.
class
)
public
void
instantiateBulkLoadingForBerkeleyDB
()
throws
RepositoryException
{
assertNotNull
(
graphProvider
.
get
());
assertNotNull
(
graphProvider
.
getBulkLoading
());
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment