Skip to content

Commit

Permalink
Add ScyllaDB driver support
Browse files Browse the repository at this point in the history
- Add ScyllaDB driver support via `janusgraph-scylla`
- `janusgraph-cql` contains tests for Cassandra3, Cassandra4, ScyllaDB. `janusgraph-scylla` contains tests for ScyllaDB only.

Fixes #1778
Fixes #2451

Signed-off-by: Oleksandr Porunov <alexandr.porunov@gmail.com>
  • Loading branch information
porunov committed Feb 12, 2023
1 parent 759266a commit bd75102
Show file tree
Hide file tree
Showing 17 changed files with 1,208 additions and 28 deletions.
20 changes: 9 additions & 11 deletions .github/workflows/ci-backend-cql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,10 @@ jobs:
args: "-Pscylladb -Dtest=\"**/graphdb/cql/*\""
name: scylladb-graphdb
java: 8
# FIXME: this takes forever to run
# - module: cql
# args: "-Pscylladb -Dtest=\"**/hadoop/*\""
# name: scylladb-hadoop
# java: 8
- module: cql
args: "-Pscylladb -Dtest=\"**/hadoop/*\""
name: scylladb-hadoop
java: 8
- module: cql
args: "-Pscylladb -Dtest=\"**/core/cql/*\""
name: scylladb-core
Expand Down Expand Up @@ -171,12 +170,11 @@ jobs:
name: scylladb-graphdb
install-args: "-Pjava-11"
java: 11
# FIXME: this takes forever to run
# - module: cql
# args: "-Pscylladb -Dtest=\"**/hadoop/*\""
# name: scylladb-hadoop
# install-args: "-Pjava-11"
# java: 11
- module: cql
args: "-Pscylladb -Dtest=\"**/hadoop/*\""
name: scylladb-hadoop
install-args: "-Pjava-11"
java: 11
- module: cql
args: "-Pscylladb -Dtest=\"**/core/cql/*\""
name: scylladb-core
Expand Down
121 changes: 121 additions & 0 deletions .github/workflows/ci-backend-scylla-dummy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Copyright 2023 JanusGraph Authors
#
# Licensed 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.

name: CI Backend ScyllaDB

on:
pull_request:
paths-ignore:
- 'docs/**'
- '.github/workflows/ci-docs.yml'
- '.github/ISSUE_TEMPLATE/**'
- 'requirements.txt'
- 'docs.Dockerfile'
- '*.md'
push:
paths-ignore:
- 'docs/**'
- '.github/workflows/ci-docs.yml'
- '.github/ISSUE_TEMPLATE/**'
- 'requirements.txt'
- 'docs.Dockerfile'
- '*.md'
branches-ignore:
- 'dependabot/**'

env:
BUILD_MAVEN_OPTS: "-DskipTests=true --batch-mode --also-make"
VERIFY_MAVEN_OPTS: "-Pcoverage"

jobs:
build-all:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: actions/setup-java@v3
with:
java-version: 8
distribution: zulu
- run: mvn clean install --projects janusgraph-all -Pjanusgraph-cache -Dmaven.javadoc.skip=true ${{ env.BUILD_MAVEN_OPTS }}
- run: mvn verify --projects janusgraph-all -Pjanusgraph-cache ${{ env.VERIFY_MAVEN_OPTS }}

tests:
runs-on: ubuntu-20.04
needs: build-all
strategy:
fail-fast: false
matrix:
include:
- module: scylla
args: "-Pscylla-murmur -Dtest=\"**/diskstorage/cql/*\""
name: murmur-diskstorage
java: 8
- module: scylla
args: "-Pscylla-murmur -Dtest=\"**/graphdb/cql/*\""
name: murmur-graphdb
java: 8
- module: scylla
args: "-Pscylla-murmur -Dtest=\"**/hadoop/*\""
name: murmur-hadoop
java: 8
- module: scylla
args: "-Pscylla-murmur -Dtest=\"**/core/cql/*\""
name: murmur-core
java: 8
- module: scylla
args: "-Pscylla-murmur-ssl -Dtest=\"**/diskstorage/cql/CQLStoreTest.java\""
name: murmur-ssl
java: 8
- module: scylla
args: "-Pscylla-murmur-client-auth -Dtest=\"**/diskstorage/cql/CQLStoreTest.java\""
name: murmur-client-auth
java: 8
- module: scylla
args: "-Pscylla-murmur -Dtest=\"**/diskstorage/cql/*\""
name: murmur-diskstorage
install-args: "-Pjava-11"
java: 11
- module: scylla
args: "-Pscylla-murmur -Dtest=\"**/graphdb/cql/*\""
name: murmur-graphdb
install-args: "-Pjava-11"
java: 11
- module: scylla
args: "-Pscylla-murmur -Dtest=\"**/hadoop/*\""
name: murmur-hadoop
install-args: "-Pjava-11"
java: 11
- module: scylla
args: "-Pscylla-murmur -Dtest=\"**/core/cql/*\""
name: murmur-core
install-args: "-Pjava-11"
java: 11
- module: scylla
args: "-Pscylla-murmur-ssl -Dtest=\"**/diskstorage/cql/CQLStoreTest.java\""
name: murmur-ssl
install-args: "-Pjava-11"
java: 11
- module: scylla
args: "-Pscylla-murmur-client-auth -Dtest=\"**/diskstorage/cql/CQLStoreTest.java\""
name: murmur-client-auth
install-args: "-Pjava-11"
java: 11
steps:
- run: 'echo "No build required"'
177 changes: 177 additions & 0 deletions .github/workflows/ci-backend-scylla.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
# Copyright 2023 JanusGraph Authors
#
# Licensed 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.

name: CI Backend ScyllaDB

on:
pull_request:
paths-ignore:
- 'docs/**'
- '.github/workflows/ci-docs.yml'
- '.github/ISSUE_TEMPLATE/**'
- 'requirements.txt'
- 'docs.Dockerfile'
- '*.md'
push:
paths-ignore:
- 'docs/**'
- '.github/workflows/ci-docs.yml'
- '.github/ISSUE_TEMPLATE/**'
- 'requirements.txt'
- 'docs.Dockerfile'
- '*.md'
branches-ignore:
- 'dependabot/**'

env:
BUILD_MAVEN_OPTS: "-DskipTests=true --batch-mode --also-make"
VERIFY_MAVEN_OPTS: "-Pcoverage"

jobs:
build-all:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: actions/setup-java@v3
with:
java-version: 8
distribution: zulu
- run: mvn clean install --projects janusgraph-all -Pjanusgraph-cache -Dmaven.javadoc.skip=true ${{ env.BUILD_MAVEN_OPTS }}
- run: mvn verify --projects janusgraph-all -Pjanusgraph-cache ${{ env.VERIFY_MAVEN_OPTS }}

tests:
runs-on: ubuntu-20.04
needs: build-all
strategy:
fail-fast: false
matrix:
include:
- module: scylla
args: "-Pscylla-murmur -Dtest=\"**/diskstorage/cql/*\""
name: murmur-diskstorage
java: 8
- module: scylla
args: "-Pscylla-murmur -Dtest=\"**/graphdb/cql/*\""
name: murmur-graphdb
java: 8
- module: scylla
args: "-Pscylla-murmur -Dtest=\"**/hadoop/*\""
name: murmur-hadoop
java: 8
- module: scylla
args: "-Pscylla-murmur -Dtest=\"**/core/cql/*\""
name: murmur-core
java: 8
- module: scylla
args: "-Pscylla-murmur-ssl -Dtest=\"**/diskstorage/cql/CQLStoreTest.java\""
name: murmur-ssl
java: 8
- module: scylla
args: "-Pscylla-murmur-client-auth -Dtest=\"**/diskstorage/cql/CQLStoreTest.java\""
name: murmur-client-auth
java: 8
- module: scylla
args: "-Pscylla-murmur -Dtest=\"**/diskstorage/cql/*\""
name: murmur-diskstorage
install-args: "-Pjava-11"
java: 11
- module: scylla
args: "-Pscylla-murmur -Dtest=\"**/graphdb/cql/*\""
name: murmur-graphdb
install-args: "-Pjava-11"
java: 11
- module: scylla
args: "-Pscylla-murmur -Dtest=\"**/hadoop/*\""
name: murmur-hadoop
install-args: "-Pjava-11"
java: 11
- module: scylla
args: "-Pscylla-murmur -Dtest=\"**/core/cql/*\""
name: murmur-core
install-args: "-Pjava-11"
java: 11
- module: scylla
args: "-Pscylla-murmur-ssl -Dtest=\"**/diskstorage/cql/CQLStoreTest.java\""
name: murmur-ssl
install-args: "-Pjava-11"
java: 11
- module: scylla
args: "-Pscylla-murmur-client-auth -Dtest=\"**/diskstorage/cql/CQLStoreTest.java\""
name: murmur-client-auth
install-args: "-Pjava-11"
java: 11
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: zulu
- run: mvn clean install --projects janusgraph-${{ matrix.module }} ${{ env.BUILD_MAVEN_OPTS }} ${{ matrix.install-args }}
- run: mvn verify --projects janusgraph-${{ matrix.module }} ${{ env.VERIFY_MAVEN_OPTS }} ${{ matrix.install-args }} ${{ matrix.args }}
- uses: actions/upload-artifact@v3
with:
name: jacoco-reports
path: target/jacoco-combined.exec
- uses: codecov/codecov-action@v3
with:
name: codecov-cql-${{ matrix.name }}-java-${{ matrix.java }}

full-tests:
runs-on: ubuntu-20.04
if: "github.event_name == 'push' && contains(github.event.head_commit.message, '[cql-tests]') || github.event_name == 'pull_request' && contains(github.event.pull_request.title, '[cql-tests]')"
needs: build-all
strategy:
fail-fast: false
matrix:
include:
- module: scylla
args: "-Pscylla-murmur -Dtest=\"**/diskstorage/cql/*\""
- module: scylla
args: "-Pscylla-murmur -Dtest=\"**/graphdb/cql/*\""
- module: scylla
args: "-Pscylla-murmur -Dtest=\"**/hadoop/*\""
- module: scylla
args: "-Pscylla-murmur -Dtest=\"**/core/cql/*\""
- module: scylla
args: "-Pscylla-murmur-ssl -Dtest=\"**/diskstorage/cql/CQLStoreTest.java\""
- module: scylla
args: "-Pscylla-murmur-client-auth -Dtest=\"**/diskstorage/cql/CQLStoreTest.java\""
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: actions/setup-java@v3
with:
java-version: 8
distribution: zulu
- run: mvn clean install --projects janusgraph-${{ matrix.module }} ${{ env.BUILD_MAVEN_OPTS }} ${{ matrix.install-args }}
- run: mvn verify --projects janusgraph-${{ matrix.module }} -Dcassandra.docker.version='3.0.18' ${{ env.VERIFY_MAVEN_OPTS }} ${{ matrix.args }}
12 changes: 12 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,18 @@ ElasticSearch 8 doesn't allow creating new indexes with `Mapping.PREFIX_TREE` ma
using `Mapping.PREFIX_TREE` will work in ElasticSearch 8 after migration. See
[ElasticSearch 8 migration guide](https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.0.html#geo-shape-strategy).

##### Add support for ScyllaDB driver

A new module `janusgraph-scylla` provides ability to run JanusGraph with ScyllaDB Driver which is an optimized
fork version of DataStax Java Driver for ScyllaDB storage backend.
For ScyllaDB storage backend you can use either `janusgraph-scylla` or `janusgraph-cql` (which is a general CQL storage
driver implementation). That said, it's recommended to use `janusgraph-scylla` for ScyllaDB due to the provided internal
optimizations (more about ScyllaDB driver optimizations can be found [here](https://docs.scylladb.com/stable/using-scylla/drivers/cql-drivers/scylla-java-driver.html)).

Notice that `janusgraph-cql` and `janusgraph-scylla` are mutually exclusive. Use only one module at a time and never
provide both dependencies in the same classpath. See [ScyllaDB Storage Backend documentation](storage-backend/scylladb.md) for more
information about how to make `scylla` storage.backend options available.

### Version 0.6.3 (Release Date: ???)

```xml tab='Maven'
Expand Down
2 changes: 1 addition & 1 deletion docs/configs/janusgraph-cfg.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ Configuration options for the storage backend. Some options are applicable only

| Name | Description | Datatype | Default Value | Mutability |
| ---- | ---- | ---- | ---- | ---- |
| storage.backend | 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, cql, hbase, inmemory) or to the full package and classname of a custom/third-party StoreManager implementation. | String | (no default value) | LOCAL |
| storage.backend | 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, cql, hbase, inmemory, scylla) or to the full package and classname of a custom/third-party StoreManager implementation. | String | (no default value) | LOCAL |
| storage.batch-loading | Whether to enable batch loading into the storage backend | Boolean | false | LOCAL |
| storage.buffer-size | Size of the batch in which mutations are persisted | Integer | 1024 | MASKABLE |
| storage.conf-file | Path to a configuration file for those storage backends which require/support a single separate config file. | String | (no default value) | LOCAL |
Expand Down
23 changes: 23 additions & 0 deletions docs/storage-backend/scylladb.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,26 @@ ScyllaDB is fully compatible with Cassandra. To use it as the data storage layer
- Spinning up a three-node Scylla Cluster and setting it as the data storage for the JanusGraph server
- Performing some basic graph operations

## Usage of Scylla optimized driver

JanusGraph provides `scylla` storage.backend options in addition to generic `cql` option.
ScyllaDB can work using any of those storage options, but the dedicated `scylla` backend is better optimized
for ScyllaDB. Thus, it's recommended to use `scylla` backend option with ScyllaDB whenever possible.
`scylla` storage option is included in `janusgraph-scylla` library but this library isn't shipped via `janusgraph-all`
and this library is not part of the provided JanusGraph distributions.
To make `scylla` option available in JanusGraph it's necessary to replace `org.janusgraph:janusgraph-cql`
with `org.janusgraph:janusgraph-scylla` if JanusGraph is used in Embedded Mode.
In case this options is needed to be used in JanusGraph distribution then it's necessary to replace the next libraries
in `lib` directory (all libraries can be downloaded via Maven Central Repository).
- `org.janusgraph:janusgraph-cql` with `org.janusgraph:janusgraph-scylla`
- `org.janusgraph:cassandra-hadoop-util` with `org.janusgraph:scylla-hadoop-util`
- `com.datastax.oss:java-driver-core` with `com.scylladb:java-driver-core`
- `com.datastax.oss:java-driver-query-builder` with `com.scylladb:java-driver-query-builder`
- `com.datastax.cassandra:cassandra-driver-core` with `com.scylladb:scylla-driver-core`

The versions of `com.scylladb:java-driver-core` and `com.scylladb:java-driver-query-builder` should be equal to the
version found in `pom.xml` of `org.janusgraph:janusgraph-scylla`. The version of `com.scylladb:scylla-driver-core` should
be equal to the version found in `org.janusgraph:scylla-hadoop-util`.

After replacement is done it will be possible to use `scylla` as `storage.backend` options which will use the optimized
Scylla driver.
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ public class Backend implements LockerProvider, AutoCloseable {
put(StandardStoreManager.CQL, STORAGE_HOSTS);
put(StandardStoreManager.HBASE, STORAGE_HOSTS);
//put(StandardStorageBackend.IN_MEMORY, null);
put(StandardStoreManager.SCYLLA, STORAGE_HOSTS);
}});

public static final Map<String,String> REGISTERED_LOG_MANAGERS = new HashMap<String, String>() {{
Expand Down
Loading

0 comments on commit bd75102

Please sign in to comment.