Skip to content

Commit

Permalink
add FoundationDB module (JanusGraph#22)
Browse files Browse the repository at this point in the history
Add FoundationDB - FoundationDBGraphTest mostly pass (only TTL related tests don't pass - as it's not supported)
  • Loading branch information
Marco Scoppetta authored Aug 30, 2019
1 parent ba68b57 commit 2b299e8
Show file tree
Hide file tree
Showing 18 changed files with 1,495 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,9 @@ public static StoreManagerFactory getFactory(org.janusgraph.diskstorage.configur
case "inmemory":
className = "org.janusgraph.diskstorage.keycolumnvalue.inmemory.InMemoryStoreManagerFactory";
break;
case "foundationdb":
className = "io.grakn.janusgraph.diskstorage.foundationdb.FoundationDBStoreManagerFactory";
break;
default:
throw new IllegalArgumentException("Could not find implementation class for backend: " + backendName);
}
Expand Down
80 changes: 80 additions & 0 deletions janusgraph-foundationdb/conf/janusgraph-foundationdb.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
gremlin.graph=org.janusgraph.core.JanusGraphFactory
# JanusGraph configuration sample: FoundationDB
#
# This file connects to a local FoundationDB instance.
# FoundationDB must already be started before starting JanusGraph
# with this file.

# The primary persistence provider used by JanusGraph. This is required.
# It should be set one of JanusGraph's built-in shorthand names for its
# standard storage backends (shorthands: berkeleyje, cassandrathrift,
# cassandra, astyanax, embeddedcassandra, cql, hbase, foundationdb,
# inmemory) or to the full package and classname of a custom/third-party
# StoreManager implementation.
#
# Default: (no default value)
# Data Type: String
# Mutability: LOCAL
storage.backend=com.experoinc.janusgraph.diskstorage.foundationdb.FoundationDBStoreManager

# Whether to enable JanusGraph's database-level cache, which is shared
# across all transactions. Enabling this option speeds up traversals by
# holding hot graph elements in memory, but also increases the likelihood
# of reading stale data. Disabling it forces each transaction to
# independently fetch graph elements from storage before reading/writing
# them.
#
# Default: false
# Data Type: Boolean
# Mutability: MASKABLE
cache.db-cache = false

# How long, in milliseconds, database-level cache will keep entries after
# flushing them. This option is only useful on distributed storage
# backends that are capable of acknowledging writes without necessarily
# making them immediately visible.
#
# Default: 50
# Data Type: Integer
# Mutability: GLOBAL_OFFLINE
#
# Settings with mutability GLOBAL_OFFLINE are centrally managed in
# JanusGraph's storage backend. After starting the database for the first
# time, this file's copy of this setting is ignored. Use JanusGraph's
# Management System to read or modify this value after bootstrapping.
cache.db-cache-clean-wait = 20

# Default expiration time, in milliseconds, for entries in the
# database-level cache. Entries are evicted when they reach this age even
# if the cache has room to spare. Set to 0 to disable expiration (cache
# entries live forever or until memory pressure triggers eviction when set
# to 0).
#
# Default: 10000
# Data Type: Long
# Mutability: GLOBAL_OFFLINE
#
# Settings with mutability GLOBAL_OFFLINE are centrally managed in
# JanusGraph's storage backend. After starting the database for the first
# time, this file's copy of this setting is ignored. Use JanusGraph's
# Management System to read or modify this value after bootstrapping.
cache.db-cache-time = 180000

# Size of JanusGraph's database level cache. Values between 0 and 1 are
# interpreted as a percentage of VM heap, while larger values are
# interpreted as an absolute size in bytes.
#
# Default: 0.3
# Data Type: Double
# Mutability: MASKABLE
cache.db-cache-size = 0.5

# Turn on storage adapter query parallelization
query.batch = true

# The isolation level for the FoundationDB storage adapter. This configuration
# is setup for interactive console sessions so it allows for writes that
# can span more than the lifespan of one single FoundationDB transaction.
# It is recommended that this be set to serializable or read_committed_no_write
# for production scenarios to maintain referential integrity.
storage.fdb.isolation-level=read_committed_with_write
186 changes: 186 additions & 0 deletions janusgraph-foundationdb/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<artifactId>janusgraph</artifactId>
<groupId>org.janusgraph</groupId>
<version>0.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>janusgraph-foundationdb</artifactId>

<properties>
<maven.compiler.plugin.version>3.6.2</maven.compiler.plugin.version>
<jdk.version>1.8</jdk.version>
<foundationdb.version>6.1.8</foundationdb.version>
<dependency.plugin.version>2.10</dependency.plugin.version>
<testcontainers.version>1.11.4</testcontainers.version>
<test.skip.default>false</test.skip.default>
<test.skip.tp>true</test.skip.tp>
</properties>

<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>

<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>palantir</id>
<name>bintray></name>
<url>https://dl.bintray.com/palantir/releases</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph-test</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.foundationdb</groupId>
<artifactId>fdb-java</artifactId>
<version>${foundationdb.version}</version>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<directory>${basedir}/target</directory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${dependency.plugin.version}</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<includeScope>compile</includeScope>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
<configuration>
<parallel>none</parallel>
<runOrder>alphabetical</runOrder>
<failIfNoTests>false</failIfNoTests>
<excludes>
<exclude>**/*PerformanceTest.java</exclude>
<exclude>**/*ConcurrentTest.java</exclude>
<exclude>**/*Groovy*Test.java</exclude>
<exclude>**/*ComputerTest.java</exclude>
<exclude>**/*ProcessTest.java</exclude>
<exclude>**/*ProcessPerformanceTest.java</exclude>
<exclude>**/*StructureTest.java</exclude>
</excludes>
<skip>${test.skip.default}</skip>
<!-- Use log4j.properties from module test resources -->
<systemProperties>
<property>
<name>log4j.configuration</name>
<value>file:${project.build.directory}/test-classes/log4j.properties</value>
</property>
</systemProperties>
</configuration>
<executions>
<execution>
<id>tinkerpop-test</id>
<goals>
<goal>test</goal>
</goals>
<phase>test</phase>
<configuration combine.self="override">
<reuseForks>false</reuseForks>
<forkCount>1</forkCount>
<parallel>none</parallel>
<threadCount>1</threadCount>
<perCoreThreadCount>false</perCoreThreadCount>
<includes>
<include>**/*Groovy*Test.java</include>
<include>**/*ComputerTest.java</include>
<include>**/*ProcessTest.java</include>
<include>**/*ProcessPerformanceTest.java</include>
<include>**/*StructureTest.java</include>
</includes>
<runOrder>alphabetical</runOrder>
<skipTests>${test.skip.tp}</skipTests>
<systemPropertyVariables>
<build.dir>${project.build.directory}</build.dir>
<log4j.configuration>file:${project.build.directory}/test-classes/log4j.properties</log4j.configuration>
<is.testing>true</is.testing>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
<!-- <plugin>-->
<!-- <artifactId>maven-assembly-plugin</artifactId>-->
<!-- <version>2.5.3</version>-->
<!-- <configuration>-->
<!-- <descriptor>src/assembly/dep.xml</descriptor>-->
<!-- </configuration>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>create-archive</id>-->
<!-- <phase>package</phase>-->
<!-- <goals>-->
<!-- <goal>single</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
</plugins>
</build>


</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package io.grakn.janusgraph.diskstorage.foundationdb;

import org.janusgraph.diskstorage.configuration.ConfigNamespace;
import org.janusgraph.diskstorage.configuration.ConfigOption;
import org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration;
import org.janusgraph.graphdb.configuration.PreInitializeConfigOptions;

/**
* Configuration options for the FoundationDB storage backend.
* These are managed under the 'fdb' namespace in the configuration.
*
*/
@PreInitializeConfigOptions
public interface FoundationDBConfigOptions {

ConfigNamespace FDB_NS = new ConfigNamespace(
GraphDatabaseConfiguration.STORAGE_NS,
"fdb",
"FoundationDB storage backend options");

ConfigOption<String> DIRECTORY = new ConfigOption<>(
FDB_NS,
"directory",
"The name of the JanusGraph directory in FoundationDB. It will be created if it does not exist.",
ConfigOption.Type.LOCAL,
"janusgraph");

ConfigOption<Integer> VERSION = new ConfigOption<>(
FDB_NS,
"version",
"The version of the FoundationDB cluster.",
ConfigOption.Type.LOCAL,
610);

ConfigOption<String> CLUSTER_FILE_PATH = new ConfigOption<>(
FDB_NS,
"cluster-file-path",
"Path to the FoundationDB cluster file",
ConfigOption.Type.LOCAL,
"default");

ConfigOption<String> ISOLATION_LEVEL = new ConfigOption<>(
FDB_NS,
"isolation-level",
"Options are serializable, read_committed_no_write, read_committed_with_write",
ConfigOption.Type.LOCAL,
"serializable");
}
Loading

0 comments on commit 2b299e8

Please sign in to comment.