diff --git a/.github/workflows/ci-backend-cql.yml b/.github/workflows/ci-backend-cql.yml index fac9e8f521..48e81cbd20 100644 --- a/.github/workflows/ci-backend-cql.yml +++ b/.github/workflows/ci-backend-cql.yml @@ -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: diff --git a/docs/storage-backend/cassandra.md b/docs/storage-backend/cassandra.md index 441861ef31..7da06b721d 100644 --- a/docs/storage-backend/cassandra.md +++ b/docs/storage-backend/cassandra.md @@ -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 `, otherwise the keyspace must be diff --git a/janusgraph-cql/pom.xml b/janusgraph-cql/pom.xml index 810891194b..138540a6ba 100644 --- a/janusgraph-cql/pom.xml +++ b/janusgraph-cql/pom.xml @@ -22,6 +22,7 @@ ${basedir}/.. ${cassandra.version} ${cassandra-dist.version} + 5.0.8 false @@ -370,6 +371,58 @@ + + cassandra5-byteordered + + false + + + ${test.docker.version.cassandra5} + ${test.byteordered} + true + ${test.excluded.groups},SERIAL_TESTS + + + + cassandra5-murmur + + false + + + ${test.docker.version.cassandra5} + ${test.murmur} + false + ${test.excluded.groups},SERIAL_TESTS + + + + cassandra5-murmur-ssl + + false + + + ${test.docker.version.cassandra5} + ${test.murmur} + true + false + ${test.excluded.groups},SERIAL_TESTS + + + + cassandra5-murmur-client-auth + + false + + + ${test.docker.version.cassandra5} + ${test.murmur} + true + true + false + ${test.excluded.groups},SERIAL_TESTS + + + scylladb diff --git a/janusgraph-cql/src/main/java/org/janusgraph/diskstorage/cql/CQLKeyColumnValueStore.java b/janusgraph-cql/src/main/java/org/janusgraph/diskstorage/cql/CQLKeyColumnValueStore.java index f983205126..30d5179d47 100644 --- a/janusgraph-cql/src/main/java/org/janusgraph/diskstorage/cql/CQLKeyColumnValueStore.java +++ b/janusgraph-cql/src/main/java/org/janusgraph/diskstorage/cql/CQLKeyColumnValueStore.java @@ -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. + if (cassandraMajorVersion >= 5) + return createTable.withOption("compression", ImmutableMap.of("enabled", false)); return createTable.withNoCompression(); } diff --git a/janusgraph-cql/src/test/java/org/janusgraph/JanusGraphCassandraContainer.java b/janusgraph-cql/src/test/java/org/janusgraph/JanusGraphCassandraContainer.java index 1289875de0..e015fd8199 100644 --- a/janusgraph-cql/src/test/java/org/janusgraph/JanusGraphCassandraContainer.java +++ b/janusgraph-cql/src/test/java/org/janusgraph/JanusGraphCassandraContainer.java @@ -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() { diff --git a/janusgraph-cql/src/test/resources/cassandra5-byteordered.yaml b/janusgraph-cql/src/test/resources/cassandra5-byteordered.yaml new file mode 100644 index 0000000000..2ad6676302 --- /dev/null +++ b/janusgraph-cql/src/test/resources/cassandra5-byteordered.yaml @@ -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 diff --git a/janusgraph-cql/src/test/resources/cassandra5-murmur-client-auth.yaml b/janusgraph-cql/src/test/resources/cassandra5-murmur-client-auth.yaml new file mode 100644 index 0000000000..9f5321b260 --- /dev/null +++ b/janusgraph-cql/src/test/resources/cassandra5-murmur-client-auth.yaml @@ -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 diff --git a/janusgraph-cql/src/test/resources/cassandra5-murmur-ssl.yaml b/janusgraph-cql/src/test/resources/cassandra5-murmur-ssl.yaml new file mode 100644 index 0000000000..4e651a5fc1 --- /dev/null +++ b/janusgraph-cql/src/test/resources/cassandra5-murmur-ssl.yaml @@ -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' +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 + +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 diff --git a/janusgraph-cql/src/test/resources/cassandra5-murmur.yaml b/janusgraph-cql/src/test/resources/cassandra5-murmur.yaml new file mode 100644 index 0000000000..42d5b8985a --- /dev/null +++ b/janusgraph-cql/src/test/resources/cassandra5-murmur.yaml @@ -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' +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: 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