Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/ci-backend-cql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,51 @@ jobs:
name: cassandra4-murmur-client-auth
install-args: "-Pjava-11"
java: 11
- module: cql
args: "-Pcassandra5-byteordered -Dtest=\"**/diskstorage/cql/*\""
name: cassandra5-byteordered-diskstorage
install-args: "-Pjava-11"
java: 11
- module: cql
args: "-Pcassandra5-murmur -Dtest=\"**/diskstorage/cql/*\""
name: cassandra5-murmur-diskstorage
install-args: "-Pjava-11"
java: 11
- module: cql
args: "-Pcassandra5-byteordered -Dtest=\"**/graphdb/cql/*\""
name: cassandra5-byteordered-graphdb
install-args: "-Pjava-11"
java: 11
- module: cql
args: "-Pcassandra5-murmur -Dtest=\"**/graphdb/cql/*\""
name: cassandra5-murmur-graphdb
install-args: "-Pjava-11"
java: 11
- module: cql
args: "-Pcassandra5-murmur -Dtest=\"**/hadoop/*\""
name: cassandra5-murmur-hadoop
install-args: "-Pjava-11"
java: 11
- module: cql
args: "-Pcassandra5-byteordered -Dtest=\"**/core/cql/*\""
name: cassandra5-byteordered-core
install-args: "-Pjava-11"
java: 11
- module: cql
args: "-Pcassandra5-murmur -Dtest=\"**/core/cql/*\""
name: cassandra5-murmur-core
install-args: "-Pjava-11"
java: 11
- module: cql
args: "-Pcassandra5-murmur-ssl -Dtest=\"**/diskstorage/cql/CQLStoreTest.java\""
name: cassandra5-murmur-ssl
install-args: "-Pjava-11"
java: 11
- module: cql
args: "-Pcassandra5-murmur-client-auth -Dtest=\"**/diskstorage/cql/CQLStoreTest.java\""
name: cassandra5-murmur-client-auth
install-args: "-Pjava-11"
java: 11
steps:
- uses: actions/checkout@v4
with:
Expand Down
8 changes: 8 additions & 0 deletions docs/storage-backend/cassandra.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ Cassandra has two protocols for clients to use: CQL and Thrift.
With Cassandra 4.0, Thrift support will be removed in Cassandra.
JanusGraph just supports the CQL storage backend.

!!! note
The CQL backend is integration tested against Apache Cassandra 3.11,
4.0 and 5.0 (with both the Murmur3 and ByteOrdered partitioners). The
DataStax Java driver used by JanusGraph negotiates the native protocol
automatically, and table creation adapts the `compression` options to
the format expected by the detected Cassandra major version, so no
configuration changes are required when moving between these versions.

!!! note
If security is enabled on Cassandra, the user must have
`CREATE permission on <all keyspaces>`, otherwise the keyspace must be
Expand Down
53 changes: 53 additions & 0 deletions janusgraph-cql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<top.level.basedir>${basedir}/..</top.level.basedir>
<test.docker.version.cassandra3>${cassandra.version}</test.docker.version.cassandra3>
<test.docker.version.cassandra4>${cassandra-dist.version}</test.docker.version.cassandra4>
<test.docker.version.cassandra5>5.0.8</test.docker.version.cassandra5>
<cassandra.docker.useDefaultConfigFromImage>false</cassandra.docker.useDefaultConfigFromImage>
</properties>

Expand Down Expand Up @@ -370,6 +371,58 @@
</properties>
</profile>

<profile>
<id>cassandra5-byteordered</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<cassandra.docker.version>${test.docker.version.cassandra5}</cassandra.docker.version>
<cassandra.docker.partitioner>${test.byteordered}</cassandra.docker.partitioner>
<test.skip.serial>true</test.skip.serial>
<test.cql.excludes>${test.excluded.groups},SERIAL_TESTS</test.cql.excludes>
</properties>
</profile>
<profile>
<id>cassandra5-murmur</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<cassandra.docker.version>${test.docker.version.cassandra5}</cassandra.docker.version>
<cassandra.docker.partitioner>${test.murmur}</cassandra.docker.partitioner>
<test.skip.serial>false</test.skip.serial>
<test.cql.excludes>${test.excluded.groups},SERIAL_TESTS</test.cql.excludes>
</properties>
</profile>
<profile>
<id>cassandra5-murmur-ssl</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<cassandra.docker.version>${test.docker.version.cassandra5}</cassandra.docker.version>
<cassandra.docker.partitioner>${test.murmur}</cassandra.docker.partitioner>
<cassandra.docker.useSSL>true</cassandra.docker.useSSL>
<test.skip.serial>false</test.skip.serial>
<test.cql.excludes>${test.excluded.groups},SERIAL_TESTS</test.cql.excludes>
</properties>
</profile>
<profile>
<id>cassandra5-murmur-client-auth</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<cassandra.docker.version>${test.docker.version.cassandra5}</cassandra.docker.version>
<cassandra.docker.partitioner>${test.murmur}</cassandra.docker.partitioner>
<cassandra.docker.useSSL>true</cassandra.docker.useSSL>
<cassandra.docker.enableClientAuth>true</cassandra.docker.enableClientAuth>
<test.skip.serial>false</test.skip.serial>
<test.cql.excludes>${test.excluded.groups},SERIAL_TESTS</test.cql.excludes>
</properties>
</profile>

<profile>
<id>scylladb</id>
<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,9 @@ private static CreateTableWithOptions compressionOptions(final CreateTableWithOp
final Configuration configuration,
final int cassandraMajorVersion) {
if (!configuration.get(CF_COMPRESSION)) {
// No compression
// Cassandra 5+ rejects {'sstable_compression': ''} — use {'enabled': false} instead.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CassandraContainer.withNoCompression() generates compression = {'sstable_compression': ''}, which Cassandra 5.0 rejects with "Missing sub-option 'class' for the 'compression' option". The {'enabled': false} form is accepted by Cassandra 3.x, 4.x, and 5.x, so this branch is only needed for the sstable_compression → enabled rename rather than an incompatibility in the disable-compression semantics themselves.

if (cassandraMajorVersion >= 5)
return createTable.withOption("compression", ImmutableMap.of("enabled", false));
return createTable.withNoCompression();
}
Comment on lines 339 to 344

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ private String getConfigPrefix() {
if (getVersion().startsWith("3.")) {
return "cassandra3";
}
return "cassandra4";
if (getVersion().startsWith("4.")) {
return "cassandra4";
}
return "cassandra5";
}

public JanusGraphCassandraContainer() {
Expand Down
116 changes: 116 additions & 0 deletions janusgraph-cql/src/test/resources/cassandra5-byteordered.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Copyright 2024 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.


# Cassandra 5.0 storage config YAML.
# Uses the modern unit-suffixed parameter naming introduced in Cassandra 4.1
# and made canonical in 5.0 (the legacy *_in_ms / *_in_kb / *_in_mb names still
# work as deprecated aliases but log warnings on every load).
cluster_name: 'Test Cluster'
initial_token: 0000000000000000000000000000000000
hinted_handoff_enabled: false
max_hint_window: 3h
hinted_handoff_throttle: 1024KiB
max_hints_delivery_threads: 2
hints_flush_period: 10000ms
max_hints_file_size: 128MiB
batchlog_replay_throttle: 1024KiB
authenticator: AllowAllAuthenticator
authorizer: AllowAllAuthorizer
role_manager: CassandraRoleManager
roles_validity: 2000ms
permissions_validity: 2000ms
partitioner: org.apache.cassandra.dht.ByteOrderedPartitioner
data_file_directories:
- /var/lib/cassandra/data
commitlog_directory: /var/lib/cassandra/commitlog
disk_failure_policy: stop
commit_failure_policy: stop
key_cache_size:
key_cache_save_period: 14400s
row_cache_size: 0MiB
row_cache_save_period: 0s
counter_cache_size:
counter_cache_save_period: 7200s
saved_caches_directory: /var/lib/cassandra/saved_caches
commitlog_sync: periodic
commitlog_sync_period: 10000ms
commitlog_segment_size: 32MiB
seed_provider:
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
parameters:
- seeds: "127.0.0.1"
concurrent_reads: 32
concurrent_writes: 32
concurrent_counter_writes: 32
concurrent_materialized_view_writes: 32
memtable_allocation_type: heap_buffers
index_summary_capacity:
index_summary_resize_interval: 60m
trickle_fsync: false
trickle_fsync_interval: 10240KiB
storage_port: 7000
ssl_storage_port: 7001
listen_address:
broadcast_address: 127.0.0.1
start_native_transport: true
native_transport_port: 9042
rpc_address: 0.0.0.0
broadcast_rpc_address: 127.0.0.1
rpc_keepalive: true
incremental_backups: false
snapshot_before_compaction: false
auto_snapshot: true
column_index_size: 64KiB
compaction_throughput: 16MiB/s
sstable_preemptive_open_interval: 50MiB
read_request_timeout: 5000ms
range_request_timeout: 10000ms
write_request_timeout: 2000ms
counter_write_request_timeout: 5000ms
cas_contention_timeout: 1000ms
truncate_request_timeout: 60000ms
request_timeout: 10000ms
internode_timeout: false
endpoint_snitch: SimpleSnitch
dynamic_snitch_update_interval: 100ms
dynamic_snitch_reset_interval: 600000ms
dynamic_snitch_badness_threshold: 0.1

server_encryption_options:
internode_encryption: none
keystore: conf/.keystore
keystore_password: cassandra
truststore: conf/.truststore
truststore_password: cassandra
client_encryption_options:
enabled: false
# If enabled and optional is set to true encrypted and unencrypted connections are handled.
optional: false
keystore: conf/.keystore
keystore_password: cassandra

internode_compression: dc
inter_dc_tcp_nodelay: false
trace_type_query_ttl: 86400s
trace_type_repair_ttl: 604800s
user_defined_functions_enabled: false
materialized_views_enabled: true
tombstone_warn_threshold: 1000
tombstone_failure_threshold: 100000
batch_size_warn_threshold: 5KiB
batch_size_fail_threshold: 50KiB
unlogged_batch_across_partitions_warn_threshold: 10
partition_size_warn_threshold: 100MiB
gc_warn_threshold: 1000ms
120 changes: 120 additions & 0 deletions janusgraph-cql/src/test/resources/cassandra5-murmur-client-auth.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Copyright 2024 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.


# Cassandra 5.0 storage config YAML.
# Uses the modern unit-suffixed parameter naming introduced in Cassandra 4.1
# and made canonical in 5.0 (the legacy *_in_ms / *_in_kb / *_in_mb names still
# work as deprecated aliases but log warnings on every load).
cluster_name: 'Test Cluster'
num_tokens: 4
hinted_handoff_enabled: false
max_hint_window: 3h
hinted_handoff_throttle: 1024KiB
max_hints_delivery_threads: 2
hints_flush_period: 10000ms
max_hints_file_size: 128MiB
batchlog_replay_throttle: 1024KiB
authenticator: AllowAllAuthenticator
authorizer: AllowAllAuthorizer
role_manager: CassandraRoleManager
roles_validity: 2000ms
permissions_validity: 2000ms
partitioner: org.apache.cassandra.dht.Murmur3Partitioner
data_file_directories:
- /var/lib/cassandra/data
commitlog_directory: /var/lib/cassandra/commitlog
disk_failure_policy: stop
commit_failure_policy: stop
key_cache_size:
key_cache_save_period: 14400s
row_cache_size: 0MiB
row_cache_save_period: 0s
counter_cache_size:
counter_cache_save_period: 7200s
saved_caches_directory: /var/lib/cassandra/saved_caches
commitlog_sync: periodic
commitlog_sync_period: 10000ms
commitlog_segment_size: 32MiB
seed_provider:
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
parameters:
- seeds: "127.0.0.1"
concurrent_reads: 32
concurrent_writes: 32
concurrent_counter_writes: 32
concurrent_materialized_view_writes: 32
memtable_allocation_type: heap_buffers
index_summary_capacity:
index_summary_resize_interval: 60m
trickle_fsync: false
trickle_fsync_interval: 10240KiB
storage_port: 7000
ssl_storage_port: 7001
listen_address:
broadcast_address: 127.0.0.1
start_native_transport: true
native_transport_port: 9042
rpc_address: 0.0.0.0
broadcast_rpc_address: 127.0.0.1
rpc_keepalive: true
incremental_backups: false
snapshot_before_compaction: false
auto_snapshot: true
column_index_size: 64KiB
compaction_throughput: 16MiB/s
sstable_preemptive_open_interval: 50MiB
read_request_timeout: 5000ms
range_request_timeout: 10000ms
write_request_timeout: 2000ms
counter_write_request_timeout: 5000ms
cas_contention_timeout: 1000ms
truncate_request_timeout: 60000ms
request_timeout: 10000ms
internode_timeout: false
endpoint_snitch: SimpleSnitch
dynamic_snitch_update_interval: 100ms
dynamic_snitch_reset_interval: 600000ms
dynamic_snitch_badness_threshold: 0.1

server_encryption_options:
internode_encryption: none
keystore: conf/.keystore
keystore_password: cassandra
truststore: conf/.truststore
truststore_password: cassandra
client_encryption_options:
enabled: true
# If enabled and optional is set to true encrypted and unencrypted connections are handled.
optional: false
keystore: /etc/ssl/node.keystore
keystore_password: cassandra
require_client_auth: true
truststore: /etc/ssl/node.truststore
truststore_password: cassandra
protocol: TLS

internode_compression: dc
inter_dc_tcp_nodelay: false
trace_type_query_ttl: 86400s
trace_type_repair_ttl: 604800s
user_defined_functions_enabled: false
materialized_views_enabled: true
tombstone_warn_threshold: 1000
tombstone_failure_threshold: 100000
batch_size_warn_threshold: 5KiB
batch_size_fail_threshold: 50KiB
unlogged_batch_across_partitions_warn_threshold: 10
partition_size_warn_threshold: 100MiB
gc_warn_threshold: 1000ms
Loading
Loading