Skip to content

Commit

Permalink
Introduce CASSANDRA2 version store type, deprecate CASSANDRA vers…
Browse files Browse the repository at this point in the history
…ion store type

The current `CASSANDRA` version store type uses a lot of columns in the `objs` table, which cause quite some overhead in storage. The new `CASSANDRA2` version store type works like `CASSANDRA`, but uses a single column for all object values and also serializes object-ids as binary values.
  • Loading branch information
snazy committed Aug 17, 2024
1 parent d4b4cc2 commit 2fb6138
Show file tree
Hide file tree
Showing 50 changed files with 2,850 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ as necessary. Empty sections will not end in the release notes.
store type, but uses way less columns, which reduces storage overhead for example in PostgreSQL a lot.
- Introduce new `MONGODB2` version store type, which is has the same functionality as the `MONGODB` version
store type, but uses way less attributes, which reduces storage overhead.
- Introduce new `CASSANDRA2` version store type, which is has the same functionality as the `CASSANDRA` version
store type, but uses way less attributes, which reduces storage overhead.

### Changes

Expand All @@ -48,6 +50,9 @@ as necessary. Empty sections will not end in the release notes.
- The current version store type `MONGODB` is deprecated, please migrate to the new `MONGODB2` version store
type. Please use the [Nessie Server Admin Tool](https://projectnessie.org/nessie-latest/export_import)
to migrate from the `MONGODB` version store type to `MONGODB2`.
- The current version store type `CASSANDRA` is deprecated, please migrate to the new `CASSANDRA2` version store
type. Please use the [Nessie Server Admin Tool](https://projectnessie.org/nessie-latest/export_import)
to migrate from the `CASSANDRA` version store type to `CASSANDRA2`.

### Fixes

Expand Down
2 changes: 2 additions & 0 deletions bom/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ dependencies {
api(project(":nessie-versioned-storage-cache"))
api(project(":nessie-versioned-storage-cassandra"))
api(project(":nessie-versioned-storage-cassandra-tests"))
api(project(":nessie-versioned-storage-cassandra2"))
api(project(":nessie-versioned-storage-cassandra2-tests"))
api(project(":nessie-versioned-storage-common"))
api(project(":nessie-versioned-storage-common-proto"))
api(project(":nessie-versioned-storage-common-serialize"))
Expand Down
2 changes: 2 additions & 0 deletions gradle/projects.main.properties
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ nessie-versioned-storage-bigtable-tests=versioned/storage/bigtable-tests
nessie-versioned-storage-cache=versioned/storage/cache
nessie-versioned-storage-cassandra=versioned/storage/cassandra
nessie-versioned-storage-cassandra-tests=versioned/storage/cassandra-tests
nessie-versioned-storage-cassandra2=versioned/storage/cassandra2
nessie-versioned-storage-cassandra2-tests=versioned/storage/cassandra2-tests
nessie-versioned-storage-common=versioned/storage/common
nessie-versioned-storage-common-proto=versioned/storage/common-proto
nessie-versioned-storage-common-serialize=versioned/storage/common-serialize
Expand Down
3 changes: 2 additions & 1 deletion helm/nessie/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ imagePullSecrets: []
# `quarkus.log.category."io.smallrye.config".level: DEBUG`
logLevel: INFO

# -- Which type of version store to use: IN_MEMORY, ROCKSDB, DYNAMODB, MONGODB2, CASSANDRA, JDBC2, BIGTABLE.
# -- Which type of version store to use: IN_MEMORY, ROCKSDB, DYNAMODB, MONGODB2, CASSANDRA2, JDBC2, BIGTABLE.
# Note: the version store type JDBC is deprecated, please use the Nessie Server Admin Tool to migrate to JDBC2.
# Note: the version store type MONGODB is deprecated, please use the Nessie Server Admin Tool to migrate to MONGODB2.
# Note: the version store type CASSANDRA is deprecated, please use the Nessie Server Admin Tool to migrate to CASSANDRA2.
versionStoreType: IN_MEMORY

# Cassandra settings. Only required when using CASSANDRA version store type; ignored otherwise.
Expand Down
1 change: 1 addition & 0 deletions servers/quarkus-common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ dependencies {
implementation(project(":nessie-versioned-storage-bigtable"))
implementation(project(":nessie-versioned-storage-cache"))
implementation(project(":nessie-versioned-storage-cassandra"))
implementation(project(":nessie-versioned-storage-cassandra2"))
implementation(project(":nessie-versioned-storage-common"))
implementation(project(":nessie-versioned-storage-dynamodb"))
implementation(project(":nessie-versioned-storage-inmemory"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithDefault;
import java.time.Duration;
import org.projectnessie.versioned.storage.cassandra.CassandraConfig;
import org.projectnessie.versioned.storage.cassandra2.Cassandra2Config;

/**
* When setting {@code nessie.version.store.type=CASSANDRA} which enables Apache Cassandra or
Expand All @@ -28,7 +28,7 @@
*/
@StaticInitSafe
@ConfigMapping(prefix = "nessie.version.store.cassandra")
public interface QuarkusCassandraConfig extends CassandraConfig {
public interface QuarkusCassandraConfig extends Cassandra2Config {
@Override
@WithDefault(DEFAULT_DML_TIMEOUT)
Duration dmlTimeout();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright (C) 2022 Dremio
*
* 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.
*/
package org.projectnessie.quarkus.providers.storage;

import static org.projectnessie.quarkus.config.VersionStoreConfig.VersionStoreType.CASSANDRA2;

import com.datastax.oss.quarkus.runtime.api.session.QuarkusCqlSession;
import jakarta.enterprise.context.Dependent;
import jakarta.inject.Inject;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.ExecutionException;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.projectnessie.quarkus.config.QuarkusCassandraConfig;
import org.projectnessie.quarkus.providers.versionstore.StoreType;
import org.projectnessie.versioned.storage.cassandra2.Cassandra2BackendConfig;
import org.projectnessie.versioned.storage.cassandra2.Cassandra2BackendFactory;
import org.projectnessie.versioned.storage.common.persist.Backend;

@StoreType(CASSANDRA2)
@Dependent
public class Cassandra2BackendBuilder implements BackendBuilder {

@Inject CompletionStage<QuarkusCqlSession> client;

@Inject
@ConfigProperty(name = "quarkus.cassandra.keyspace")
String keyspace;

@Inject QuarkusCassandraConfig config;

@Override
public Backend buildBackend() {
Cassandra2BackendFactory factory = new Cassandra2BackendFactory();
try {
Cassandra2BackendConfig c =
Cassandra2BackendConfig.builder()
.client(client.toCompletableFuture().get())
.keyspace(keyspace)
.ddlTimeout(config.ddlTimeout())
.dmlTimeout(config.dmlTimeout())
.build();
return factory.buildBackend(c);
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ enum VersionStoreType {
MONGODB,
/** MongoDB variant using few attributes, saves storage overhead. */
MONGODB2,
/** Cassandra variant using many distinct columns. */
CASSANDRA,
/** Cassandra variant using few columns, saves storage overhead. */
CASSANDRA2,
/** JDBC variant using many distinct columns. */
JDBC,
/** JDBC variant using few columns, saves storage overhead for example in PostgreSQL. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,10 @@ nessie.server.send-stacktrace-to-client=false
# nessie.server.authorization.rules.allow_listing_reflog=\
# op=='VIEW_REFLOG' && role=='admin_user'

### which type of version store to use: IN_MEMORY, ROCKSDB, DYNAMODB, MONGODB2, CASSANDRA, JDBC2, BIGTABLE.
### which type of version store to use: IN_MEMORY, ROCKSDB, DYNAMODB, MONGODB2, CASSANDRA2, JDBC2, BIGTABLE.
# Note: the version store type JDBC is deprecated, please use the Nessie Server Admin Tool to migrate to JDBC2.
# Note: the version store type MONGODB is deprecated, please use the Nessie Server Admin Tool to migrate to MONGODB2.
# Note: the version store type CASSANDRA is deprecated, please use the Nessie Server Admin Tool to migrate to CASSANDRA2.
nessie.version.store.type=IN_MEMORY

# Object cache size as a value relative to the JVM's max heap size. The `cache-capacity-fraction-adjust-mb`
Expand Down
1 change: 1 addition & 0 deletions servers/quarkus-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dependencies {
implementation(project(":nessie-versioned-tests"))
implementation(project(":nessie-versioned-storage-bigtable-tests"))
implementation(project(":nessie-versioned-storage-cassandra-tests"))
implementation(project(":nessie-versioned-storage-cassandra2-tests"))
implementation(project(":nessie-versioned-storage-dynamodb-tests"))
implementation(project(":nessie-versioned-storage-jdbc-tests"))
implementation(project(":nessie-versioned-storage-jdbc2-tests"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
import java.util.Map;
import java.util.Optional;
import org.projectnessie.versioned.storage.cassandratests.CassandraBackendTestFactory;
import org.projectnessie.versioned.storage.cassandra2tests.CassandraBackendTestFactory;

public class CassandraTestResourceLifecycleManager
implements QuarkusTestResourceLifecycleManager, DevServicesContext.ContextAware {
Expand Down
1 change: 1 addition & 0 deletions servers/services-bench/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ dependencies {
jmhRuntimeOnly(project(":nessie-versioned-storage-inmemory"))
jmhRuntimeOnly(project(":nessie-versioned-storage-bigtable"))
jmhRuntimeOnly(project(":nessie-versioned-storage-cassandra"))
jmhRuntimeOnly(project(":nessie-versioned-storage-cassandra2"))
jmhRuntimeOnly(project(":nessie-versioned-storage-rocksdb"))
jmhRuntimeOnly(project(":nessie-versioned-storage-mongodb"))
jmhRuntimeOnly(project(":nessie-versioned-storage-mongodb2"))
Expand Down
1 change: 1 addition & 0 deletions servers/services/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ dependencies {
testFixturesApi(project(":nessie-services-config"))
testFixturesImplementation(libs.logback.classic)
intTestImplementation(project(":nessie-versioned-storage-cassandra-tests"))
intTestImplementation(project(":nessie-versioned-storage-cassandra2-tests"))
intTestImplementation(project(":nessie-versioned-storage-rocksdb-tests"))
intTestImplementation(project(":nessie-versioned-storage-mongodb-tests"))
intTestImplementation(project(":nessie-versioned-storage-mongodb2-tests"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;
import org.junit.jupiter.api.extension.ExtendWith;
import org.projectnessie.versioned.storage.cassandratests.CassandraBackendTestFactory;
import org.projectnessie.versioned.storage.cassandra2tests.CassandraBackendTestFactory;
import org.projectnessie.versioned.storage.testextension.NessieBackend;
import org.projectnessie.versioned.storage.testextension.PersistExtension;

Expand Down
5 changes: 5 additions & 0 deletions site/in-dev/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,11 @@ Related Quarkus settings:
The `MONGODB` version store type is _deprecated for removal_, please use the
[Nessie Server Admin Tool](export_import.md) to migrate from the `MONGODB` version store type to `MONGODB2`.

!!! warn
Prefer the `CASSANDRA2` version store type over the `CASSANDRA` version store type, because it has way less storage overhead.
The `CASSANDRA` version store type is _deprecated for removal_, please use the
[Nessie Server Admin Tool](export_import.md) to migrate from the `CASSANDRA` version store type to `CASSANDRA2`.

!!! warn
Prefer the `JDBC2` version store type over the `JDBC` version store type, because it has way less storage overhead.
The `JDBC` version store type is _deprecated for removal_, please use the
Expand Down
1 change: 1 addition & 0 deletions tools/doc-generator/doclet/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ val genProjectPaths =
":nessie-quarkus-auth",
":nessie-versioned-storage-bigtable",
":nessie-versioned-storage-cassandra",
":nessie-versioned-storage-cassandra2",
":nessie-versioned-storage-common",
":nessie-versioned-storage-dynamodb",
":nessie-versioned-storage-inmemory",
Expand Down
1 change: 1 addition & 0 deletions tools/doc-generator/site-gen/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ val genProjectPaths = listOf(
":nessie-services-config",
":nessie-versioned-storage-bigtable",
":nessie-versioned-storage-cassandra",
":nessie-versioned-storage-cassandra2",
":nessie-versioned-storage-common",
":nessie-versioned-storage-dynamodb",
":nessie-versioned-storage-inmemory",
Expand Down
2 changes: 2 additions & 0 deletions tools/server-admin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ dependencies {
implementation(project(":nessie-versioned-storage-bigtable"))
implementation(project(":nessie-versioned-storage-cache"))
implementation(project(":nessie-versioned-storage-cassandra"))
implementation(project(":nessie-versioned-storage-cassandra2"))
implementation(project(":nessie-versioned-storage-common"))
implementation(project(":nessie-versioned-storage-dynamodb"))
implementation(project(":nessie-versioned-storage-inmemory"))
Expand Down Expand Up @@ -97,6 +98,7 @@ dependencies {
intTestImplementation(project(":nessie-versioned-storage-jdbc-tests"))
intTestImplementation(project(":nessie-versioned-storage-jdbc2-tests"))
intTestImplementation(project(":nessie-versioned-storage-cassandra-tests"))
intTestImplementation(project(":nessie-versioned-storage-cassandra2-tests"))
intTestImplementation(project(":nessie-versioned-storage-bigtable-tests"))
intTestImplementation(project(":nessie-versioned-storage-dynamodb-tests"))
intTestImplementation(project(":nessie-multi-env-test-engine"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
@ExtendWith({NessieServerAdminTestExtension.class, SoftAssertionsExtension.class})
public class ITExportImport {

private static final String VERSION_STORES = "(ROCKSDB|DYNAMODB|MONGODB2|CASSANDRA|JDBC2|BIGTABLE)";
private static final String VERSION_STORES = "(ROCKSDB|DYNAMODB|MONGODB2|CASSANDRA2|JDBC2|BIGTABLE)";

@InjectSoftAssertions private SoftAssertions soft;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.util.Map;
import org.projectnessie.quarkus.config.VersionStoreConfig.VersionStoreType;
import org.projectnessie.versioned.storage.bigtabletests.BigTableBackendContainerTestFactory;
import org.projectnessie.versioned.storage.cassandratests.CassandraBackendTestFactory;
import org.projectnessie.versioned.storage.cassandra2tests.CassandraBackendTestFactory;
import org.projectnessie.versioned.storage.dynamodbtests.DynamoDBBackendTestFactory;
import org.projectnessie.versioned.storage.jdbc2tests.MariaDBBackendTestFactory;
import org.projectnessie.versioned.storage.jdbc2tests.MySQLBackendTestFactory;
Expand Down Expand Up @@ -71,7 +71,7 @@ BackendTestFactory backendFactory() {

@Override
Map<String, String> quarkusConfig() {
return Map.of("nessie.version.store.type", VersionStoreType.CASSANDRA.name());
return Map.of("nessie.version.store.type", VersionStoreType.CASSANDRA2.name());
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.projectnessie.versioned.storage.cassandra;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;
import org.projectnessie.versioned.storage.cassandratests.ScyllaDBBackendTestFactory;
Expand All @@ -26,4 +27,5 @@
disabledReason =
"ScyllaDB fails to start, see https://github.com/scylladb/scylladb/issues/10135")
@NessieBackend(ScyllaDBBackendTestFactory.class)
@Disabled("Disabled in favor of CASSANDRA2")
public class ITScyllaDBPersist extends AbstractPersistTests {}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.projectnessie.versioned.storage.cassandra;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;
import org.projectnessie.versioned.storage.cassandratests.ScyllaDBBackendTestFactory;
Expand All @@ -26,4 +27,5 @@
disabledReason =
"ScyllaDB fails to start, see https://github.com/scylladb/scylladb/issues/10135")
@NessieBackend(ScyllaDBBackendTestFactory.class)
@Disabled("Disabled in favor of CASSANDRA2")
public class ITScyllaDBVersionStore extends AbstractVersionStoreTests {}
45 changes: 45 additions & 0 deletions versioned/storage/cassandra2-tests/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (C) 2022 Dremio
*
* 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.
*/

plugins {
id("nessie-conventions-server")
id("nessie-jacoco")
}

publishingHelper { mavenName = "Nessie - Storage - Cassandra & ScyllaDB - Tests" }

description = "Base test code for creating test backends using Cassandra & ScyllaDB."

dependencies {
implementation(project(":nessie-versioned-storage-cassandra2"))
implementation(project(":nessie-versioned-storage-common"))
implementation(project(":nessie-versioned-storage-testextension"))
implementation(project(":nessie-container-spec-helper"))

compileOnly(libs.jakarta.annotation.api)

compileOnly(libs.immutables.builder)
compileOnly(libs.immutables.value.annotations)
annotationProcessor(libs.immutables.value.processor)

implementation(platform(libs.cassandra.driver.bom))
implementation("com.datastax.oss:java-driver-core")

implementation(platform(libs.testcontainers.bom))
implementation("org.testcontainers:cassandra") {
exclude("com.datastax.cassandra", "cassandra-driver-core")
}
}
Loading

0 comments on commit 2fb6138

Please sign in to comment.