Skip to content
This repository was archived by the owner on Oct 5, 2021. It is now read-only.

Commit 5603ad3

Browse files
Alexander PatrikalakisAlexander Patrikalakis
authored andcommitted
Support for JanusGraph 0.1.1
1 parent e079c98 commit 5603ad3

14 files changed

+39
-419
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ account in the same region.
2828
multiple-item model based on graph size and utilization.
2929
* Test graph locally with DynamoDB Local.
3030
* Integrated with JanusGraph metrics.
31-
* JanusGraph 0.1.0 and TinkerPop 3.2.3 compatibility.
31+
* JanusGraph 0.1.1 and TinkerPop 3.2.3 compatibility.
3232
* Upgrade compatibility from Titan 1.0.0.
3333

3434
## Getting Started

dynamodb-janusgraph-storage-backend-cfn.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ Resources:
505505
- "sdk install java < /dev/null && sdk install maven < /dev/null && set -x\n"
506506
- "export GREMLIN_SERVER_USERNAME='ec2-user'\n"
507507
- "export LOG_DIR=/var/log/gremlin-server\n"
508-
- "export SERVER_DIRNAME=dynamodb-janusgraph010-storage-backend-1.0.0\n"
508+
- "export SERVER_DIRNAME=dynamodb-janusgraph-storage-backend-1.1.0\n"
509509
- "export SERVER_ZIP=${SERVER_DIRNAME}.zip\n"
510510
- "export PACKAGES_DIR=/usr/local/packages\n"
511511
- "export INSTALL_DIR=${PACKAGES_DIR}/${SERVER_DIRNAME}\n"

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>com.amazonaws</groupId>
4-
<artifactId>dynamodb-janusgraph010-storage-backend</artifactId>
5-
<version>1.0.0</version>
4+
<artifactId>dynamodb-janusgraph-storage-backend</artifactId>
5+
<version>1.1.0</version>
66
<packaging>jar</packaging>
77
<name>Amazon DynamoDB Storage Backend for JanusGraph</name>
88
<url>https://github.com/awslabs/dynamodb-titan-storage-backend</url>
99
<description>The Amazon DynamoDB Storage Backend for JanusGraph: Distributed Graph Database allows JanusGraph graphs to use DynamoDB as a storage backend.</description>
1010
<scm>
1111
<url>[email protected]:awslabs/dynamodb-titan-storage-backend.git</url>
12-
<tag>janusgraph0.1.0-1.0.0</tag>
12+
<tag>janusgraph0.1.1-1.0.0</tag>
1313
</scm>
1414
<properties>
1515
<default.test.jvm.opts>-Xms256m -Xmx1280m -XX:+HeapDumpOnOutOfMemoryError</default.test.jvm.opts>
@@ -19,7 +19,7 @@
1919
<dynamodb-local.endpoint>http://localhost:${dynamodb-local.port}</dynamodb-local.endpoint>
2020
<jdk.version>1.8</jdk.version>
2121
<aws.java.sdk.version>1.11.125</aws.java.sdk.version>
22-
<janusgraph.version>0.1.0</janusgraph.version>
22+
<janusgraph.version>0.1.1</janusgraph.version>
2323
<tinkerpop.version>3.2.3</tinkerpop.version>
2424
<dependency.plugin.version>2.10</dependency.plugin.version>
2525
<maven.assembly.plugin.version>2.5.5</maven.assembly.plugin.version>

src/main/java/com/amazon/janusgraph/diskstorage/dynamodb/AbstractDynamoDBStore.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,13 @@
1414
*/
1515
package com.amazon.janusgraph.diskstorage.dynamodb;
1616

17-
import static com.amazon.janusgraph.diskstorage.dynamodb.Constants.DYNAMODB_USE_TITAN_ID_STORE;
18-
1917
import java.util.List;
2018
import java.util.concurrent.Callable;
2119
import java.util.concurrent.ExecutionException;
2220
import java.util.concurrent.TimeUnit;
2321

2422
import org.apache.commons.codec.binary.Hex;
2523
import org.apache.commons.lang3.tuple.Pair;
26-
import org.janusgraph.diskstorage.Backend;
2724
import org.janusgraph.diskstorage.BackendException;
2825
import org.janusgraph.diskstorage.Entry;
2926
import org.janusgraph.diskstorage.StaticBuffer;
@@ -75,11 +72,7 @@ public AbstractDynamoDBStore(final DynamoDBStoreManager manager, final String pr
7572
this.manager = manager;
7673
this.client = this.manager.client();
7774
this.storeName = storeName;
78-
if (Backend.ID_STORE_NAME.equals(storeName) && manager.getStorageConfig().get(DYNAMODB_USE_TITAN_ID_STORE)) {
79-
this.tableName = prefix + "_titan_ids";
80-
} else {
81-
this.tableName = prefix + "_" + storeName;
82-
}
75+
this.tableName = prefix + "_" + storeName;
8376
this.forceConsistentRead = client.forceConsistentRead();
8477

8578
final CacheBuilder<Pair<StaticBuffer, StaticBuffer>, DynamoDBStoreTransaction> builder = CacheBuilder.newBuilder().concurrencyLevel(client.delegate().getMaxConcurrentUsers())

src/main/java/com/amazon/janusgraph/diskstorage/dynamodb/Client.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.util.concurrent.TimeUnit;
3030

3131
import org.janusgraph.diskstorage.configuration.Configuration;
32+
import org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration;
3233
import org.janusgraph.util.stats.MetricManager;
3334

3435
import com.amazonaws.ClientConfiguration;
@@ -139,7 +140,8 @@ public Client(org.janusgraph.diskstorage.configuration.Configuration config) {
139140
final Map<String, RateLimiter> readRateLimit = new HashMap<>();
140141
final Map<String, RateLimiter> writeRateLimit = new HashMap<>();
141142

142-
final Set<String> storeNames = new HashSet<>(config.get(Constants.DYNAMODB_USE_TITAN_ID_STORE) ? Constants.ALTERNATE_BACKEND_STORES : Constants.REQUIRED_BACKEND_STORES);
143+
final Set<String> storeNames = new HashSet<>(Constants.REQUIRED_BACKEND_STORES);
144+
storeNames.add(config.get(GraphDatabaseConfiguration.IDS_STORE_NAME));
143145
storeNames.addAll(config.getContainedNamespaces(Constants.DYNAMODB_STORES_NAMESPACE));
144146
storeNames.forEach(storeName -> setupStore(config, prefix, readRateLimit, writeRateLimit, storeName));
145147

src/main/java/com/amazon/janusgraph/diskstorage/dynamodb/Constants.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ public class Constants {
4949

5050
public static final List<String> REQUIRED_BACKEND_STORES = Arrays.asList(Backend.EDGESTORE_NAME, //
5151
Backend.INDEXSTORE_NAME,
52-
Backend.ID_STORE_NAME,
53-
Backend.SYSTEM_TX_LOG_NAME,
54-
Backend.SYSTEM_MGMT_LOG_NAME,
55-
GraphDatabaseConfiguration.SYSTEM_PROPERTIES_STORE_NAME);
56-
public static final List<String> ALTERNATE_BACKEND_STORES = Arrays.asList(Backend.EDGESTORE_NAME, //
57-
"titan_ids",
58-
Backend.ID_STORE_NAME,
5952
Backend.SYSTEM_TX_LOG_NAME,
6053
Backend.SYSTEM_MGMT_LOG_NAME,
6154
GraphDatabaseConfiguration.SYSTEM_PROPERTIES_STORE_NAME);
@@ -119,10 +112,6 @@ public class Constants {
119112
public static final ConfigOption<Boolean> DYNAMODB_USE_NATIVE_LOCKING = new ConfigOption<>(DYNAMODB_CONFIGURATION_NAMESPACE,
120113
"native-locking", "Set this to false if you need to use JanusGraph's locking mechanism for remote lock expiry.",
121114
FIXED, true);
122-
public static final ConfigOption<Boolean> DYNAMODB_USE_TITAN_ID_STORE = new ConfigOption<>(DYNAMODB_CONFIGURATION_NAMESPACE,
123-
"use-titan-ids", "Set this to true if you are migrating from Titan to JanusGraph so that you do not have to "
124-
+ "copy your titan_ids table.",
125-
LOCAL, false);
126115

127116
//begin adaptation of the following block up until line 63
128117
//https://github.com/buka/titan/blob/master/src/main/java/com/thinkaurelius/titan/diskstorage/dynamodb/DynamoDBClient.java#L29

src/main/java/com/amazon/janusgraph/diskstorage/dynamodb/DynamoDBDelegate.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,6 @@ static AwsClientBuilder.EndpointConfiguration getEndpointConfiguration(Optional<
201201
}
202202
}
203203

204-
@VisibleForTesting
205-
AmazonDynamoDB client() {
206-
return client;
207-
}
208-
209204
private <T extends AmazonWebServiceRequest> T setUserAgent(T request) {
210205
request.putCustomRequestHeader(USER_AGENT, Constants.JANUSGRAPH_USER_AGENT);
211206
return request;

src/test/java/com/amazon/janusgraph/TestGraphUtil.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.apache.commons.configuration.PropertiesConfiguration;
2626
import org.janusgraph.core.JanusGraph;
2727
import org.janusgraph.core.JanusGraphFactory;
28-
import org.janusgraph.diskstorage.Backend;
2928
import org.janusgraph.diskstorage.BackendException;
3029
import org.janusgraph.diskstorage.configuration.BasicConfiguration;
3130
import org.janusgraph.diskstorage.configuration.BasicConfiguration.Restriction;
@@ -111,12 +110,8 @@ public Configuration createTestGraphConfig(final BackendDataModel backendDataMod
111110
final Configuration properties = createTestConfig(backendDataModel);
112111

113112
final String storesNsPrefix = "storage.dynamodb.stores.";
114-
final List<String> storeList;
115-
if (properties.getBoolean("storage.dynamodb.use-titan-ids", true)) {
116-
storeList = Constants.ALTERNATE_BACKEND_STORES;
117-
} else {
118-
storeList = Constants.REQUIRED_BACKEND_STORES;
119-
}
113+
final List<String> storeList = new ArrayList<>(Constants.REQUIRED_BACKEND_STORES);
114+
storeList.add(GraphDatabaseConfiguration.IDS_STORE_NAME.getDefaultValue());
120115
for (String store : storeList) {
121116
configureStore(dataModelName, provisionedReadAndWriteTps, properties, unlimitedIops, storesNsPrefix + store);
122117
}

src/test/java/com/amazon/janusgraph/graphdb/dynamodb/AbstractDynamoDBGraphTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ protected AbstractDynamoDBGraphTest(BackendDataModel model) {
5454
@Override
5555
public WriteConfiguration getConfiguration() {
5656
final String methodName = testName.getMethodName();
57-
final List<String> extraStoreNames = methodName.contains("simpleLogTest") ? Collections.singletonList("ulog_test") : Collections.<String>emptyList();
58-
return TestGraphUtil.instance.graphConfigWithClusterPartitionsAndExtraStores(model, extraStoreNames, 1 /*titanClusterPartitions*/);
57+
final List<String> extraStoreNames = methodName.contains("simpleLogTest") ? Collections.singletonList("ulog_test") : Collections.emptyList();
58+
return TestGraphUtil.instance.graphConfigWithClusterPartitionsAndExtraStores(model, extraStoreNames, 1 /*janusGraphClusterPartitions*/);
5959
}
6060

6161
@AfterClass

src/test/java/com/amazon/janusgraph/graphdb/dynamodb/AbstractDynamoDBPartitionGraphTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ protected AbstractDynamoDBPartitionGraphTest(BackendDataModel model) {
5252
public WriteConfiguration getBaseConfiguration()
5353
{
5454
return TestGraphUtil.instance.graphConfigWithClusterPartitionsAndExtraStores(model,
55-
Collections.<String>emptyList(), 8 /*titanClusterPartitions*/);
55+
Collections.emptyList(), 8 /*janusGraphClusterPartitions*/);
5656
}
5757

5858
@AfterClass

0 commit comments

Comments
 (0)