Skip to content

feat(rocksdb): support ToplingDB provider#3024

Open
WaterWhisperer wants to merge 53 commits into
apache:masterfrom
WaterWhisperer:toplingdb-rebase
Open

feat(rocksdb): support ToplingDB provider#3024
WaterWhisperer wants to merge 53 commits into
apache:masterfrom
WaterWhisperer:toplingdb-rebase

Conversation

@WaterWhisperer
Copy link
Copy Markdown

@WaterWhisperer WaterWhisperer commented May 12, 2026

Purpose of the PR

Add ToplingDB support as an optional RocksDB-compatible storage path.

This PR rebases and prepares the existing ToplingDB adaptation work for review on the current master. ToplingDB is integrated as an optional provider for RocksDB-based storage, allowing users to enable RocksDB/ToplingDB configuration and the ToplingDB Web UI while preserving the standard RocksDB path.

Main Changes

  • Add hugegraph-rocksdb-provider module
  • Update HugeGraph Server RocksDB integration
  • Add ToplingDB preload support in server dist
  • Add PD / Store ToplingDB integration
  • Add Maven / CI / dependency metadata updates
  • Add ToplingDB docs and specs

Verifying these changes

  • Trivial rework / code cleanup without any test coverage. (No Need)
  • Already covered by existing tests, such as (please modify tests here).
  • Need tests and can be verified as follows:
    • Built packaged dist artifacts for Server / PD / Store
    • Verified packaged rocksdbjni-8.10.2-SNAPSHOT.jar contains ToplingDB resources including org/rocksdb/SidePluginRepo.class
    • Ran Server with ToplingDB enabled
    • Ran Server without rocksdb.option_path
    • Ran PD / Store with ToplingDB config

Does this PR potentially affect the following parts?

  • Dependencies (add/update license info & regenerate_known_dependencies.sh)
  • Modify configurations
  • The public API
  • Other affects (typed here)
    • Adds native library preload logic for ToplingDB-enabled RocksDB JNI runtime.
    • Adds optional ToplingDB Web UI support.
    • Adds RocksDB provider SPI and routes RocksDB opening through the provider loader.
  • Nope

Documentation Status

  • Doc - TODO
  • Doc - Done
  • Doc - No Need

syslucas added 30 commits May 11, 2026 00:05
@dosubot dosubot Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. dependencies Incompatible dependencies of package feature New feature pd PD module store Store module labels May 12, 2026
@WaterWhisperer WaterWhisperer marked this pull request as draft May 13, 2026 07:38
@WaterWhisperer WaterWhisperer marked this pull request as ready for review May 24, 2026 16:49
@imbajin imbajin requested a review from Copilot May 27, 2026 10:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an SPI-based RocksDB provider layer to support ToplingDB as an optional RocksDB-compatible backend, including config options for Topling YAML parameters and optional HTTP UI, plus distro/CI packaging changes to preload native libraries and web assets.

Changes:

  • Introduce hugegraph-rocksdb-provider module with provider discovery/selection and Standard/Topling providers.
  • Route Server/Store/PD RocksDB open/close through the provider loader and add rocksdb.option_path / rocksdb.open_http configs.
  • Add preload scripts/resources and CI workflow updates to support ToplingDB artifacts and runtime prerequisites.

Reviewed changes

Copilot reviewed 53 out of 61 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
pom.xml Adds provider module, sets rocksdbjni.version, and excludes extracted Topling HTML/CSS from checks.
install-dist/scripts/dependency/known-dependencies.txt Updates known dependency inventory for new/updated jars (incl. snapshot rocksdbjni).
install-dist/release-docs/licenses/LICENSE-rocksdbjni-8.10.2-SNAPSHOT.txt Adds license text for the snapshot rocksdbjni distribution.
install-dist/release-docs/LICENSE Updates LICENSE entries for new/updated dependencies and rocksdbjni source.
hugegraph-store/hg-store-rocksdb/src/main/java/org/apache/hugegraph/rocksdb/access/RocksDBSession.java Switches RocksDB open/close to RocksDBProviderLoader and passes option/http params.
hugegraph-store/hg-store-rocksdb/src/main/java/org/apache/hugegraph/rocksdb/access/RocksDBOptions.java Adds rocksdb.option_path and rocksdb.open_http options for store.
hugegraph-store/hg-store-rocksdb/pom.xml Replaces direct rocksdbjni dependency with hugegraph-rocksdb-provider.
hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/metrics/RocksDBMetricsConst.java Removes metrics constants no longer available in RocksDB 8.x.
hugegraph-store/hg-store-dist/src/assembly/static/conf/rocksdb_store.yaml Adds sample Topling/RocksDB YAML config for store.
hugegraph-store/hg-store-dist/src/assembly/static/conf/application-pd.yml Documents new RocksDB option_path/open_http config fields.
hugegraph-store/hg-store-dist/src/assembly/static/bin/util.sh Adds helper to locate server dist dir for preload integration.
hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh Sources server preload script when available before starting store.
hugegraph-store/hg-store-core/pom.xml Updates jraft-core version.
hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/rocksdb/RocksDBSessionsTest.java Formatting-only update in test code.
hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBStore.java Formatting-only change in signature wrapping.
hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBStdSessions.java Opens RocksDB via provider loader and gates Topling HTTP to GRAPH_STORE.
hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBOptions.java Adds rocksdb.option_path and rocksdb.open_http options for server.
hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/OpenedRocksDB.java Closes RocksDB via provider loader to enable provider-specific cleanup.
hugegraph-server/hugegraph-rocksdb/pom.xml Replaces direct rocksdbjni dependency with hugegraph-rocksdb-provider.
hugegraph-server/hugegraph-dist/src/assembly/travis/run-unit-test.sh Installs RocksDB/Topling runtime prereqs before running unit tests.
hugegraph-server/hugegraph-dist/src/assembly/travis/run-core-test.sh Installs RocksDB/Topling runtime prereqs before running core tests.
hugegraph-server/hugegraph-dist/src/assembly/travis/run-api-test.sh Installs RocksDB/Topling runtime prereqs before API tests.
hugegraph-server/hugegraph-dist/src/assembly/travis/install-rocksdb.sh New helper to preload Topling libs/resources in CI.
hugegraph-server/hugegraph-dist/src/assembly/travis/install-deps.sh New helper to install native deps (liburing/libaio/jemalloc) in CI.
hugegraph-server/hugegraph-dist/src/assembly/static/conf/graphs/rocksdb_server.yaml Adds sample Topling/RocksDB YAML config for server.
hugegraph-server/hugegraph-dist/src/assembly/static/conf/graphs/hugegraph.properties Documents new rocksdb.option_path / rocksdb.open_http properties.
hugegraph-server/hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh Sources preload script before starting server.
hugegraph-server/hugegraph-dist/src/assembly/static/bin/preload-topling.sh New preload entrypoint to extract/preload native libs + resources.
hugegraph-server/hugegraph-dist/src/assembly/static/bin/init-store.sh Sources preload script before store initialization.
hugegraph-server/hugegraph-dist/src/assembly/static/bin/common-topling.sh New shared functions for extracting/preloading libs/resources and compat workarounds.
hugegraph-server/hugegraph-core/pom.xml Updates jraft version property.
hugegraph-rocksdb-provider/src/main/resources/META-INF/services/org.apache.hugegraph.rocksdb.provider.RocksDBProvider Registers Standard and Topling providers for SPI discovery.
hugegraph-rocksdb-provider/src/main/java/org/apache/hugegraph/rocksdb/provider/ToplingRocksDBProvider.java Implements Topling SidePluginRepo reflection, YAML validation, and optional HTTP start.
hugegraph-rocksdb-provider/src/main/java/org/apache/hugegraph/rocksdb/provider/StandardRocksDBProvider.java Implements standard RocksDB open/close behavior.
hugegraph-rocksdb-provider/src/main/java/org/apache/hugegraph/rocksdb/provider/RocksDBProviderLoader.java Adds provider discovery, priority selection, and open/close delegates.
hugegraph-rocksdb-provider/src/main/java/org/apache/hugegraph/rocksdb/provider/RocksDBProvider.java Defines SPI interface for provider open/close operations.
hugegraph-rocksdb-provider/src/main/java/org/apache/hugegraph/rocksdb/provider/AbstractRocksDBProvider.java Adds base implementation for provider lifecycle and close handling.
hugegraph-rocksdb-provider/pom.xml New module POM and dependency declarations for provider layer.
hugegraph-pd/hg-pd-dist/src/assembly/static/conf/rocksdb_pd.yaml Adds sample Topling/RocksDB YAML config for PD.
hugegraph-pd/hg-pd-dist/src/assembly/static/conf/application.yml Documents optional rocksdb option-path/open-http config in PD dist.
hugegraph-pd/hg-pd-dist/src/assembly/static/bin/util.sh Adds helper to locate server dist dir for preload integration.
hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh Sources server preload script when available before starting PD.
hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/store/HgKVStoreImpl.java Opens/closes RocksDB via provider loader and threads option/http configs through.
hugegraph-pd/hg-pd-core/src/main/java/org/apache/hugegraph/pd/config/PDConfig.java Adds Spring-configurable rocksdb.option-path and rocksdb.open-http properties.
hugegraph-pd/hg-pd-core/pom.xml Updates dependencies to use provider module and updates jraft version.
hugegraph-pd/hg-pd-cli/pom.xml Updates jraft version.
docs/toplingdb/toplingdb.md Adds ToplingDB feature/design/configuration documentation.
docs/toplingdb/toplingdb-troubleshooting.md Adds troubleshooting guide for YAML/HTTP/lock issues.
docs/toplingdb/toplingdb-security.md Adds security hardening recommendations for ToplingDB usage.
docs/toplingdb/toplingdb-operations.md Adds operational guidance (monitoring/tuning/upgrade).
.specs/hugegraph-server/ToplingDB/task.md Adds implementation task breakdown for ToplingDB work.
.specs/hugegraph-server/ToplingDB/requirements.md Adds requirements spec for ToplingDB support.
.specs/hugegraph-server/ToplingDB/design.md Adds design spec describing preload and open logic.
.github/workflows/server-ci.yml Updates CI to package artifacts, install deps, and enable GitHub Packages access.
.github/workflows/pd-store-ci.yml Updates CI packaging/deps/preload flow and enables GitHub Packages access.
.github/workflows/licence-checker.yml Enables stage repo usage in workflow env.
.github/workflows/commons-ci.yml Enables stage repo usage and adds GitHub Packages env vars.
.github/workflows/codeql-analysis.yml Enables stage repo usage and adds GitHub Packages permissions/env vars.
.github/workflows/cluster-test-ci.yml Enables stage repo usage and adds GitHub Packages env vars.
.github/workflows/check-dependencies.yml Enables stage repo usage and adds GitHub Packages env vars.
.github/configs/settings.xml Adds GitHub Packages repo for ToplingDB snapshot dependency resolution.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +42 to +51
try {
// Delegate to provider-specific implementation
RocksDB rocksDB = doOpenRocksDB(options, dataPath);

return rocksDB;
} catch (Exception e) {
LOG.error("Failed to open RocksDB with provider: {} at path: {}",
getProviderName(), dataPath, e);
throw e;
}
Comment on lines +61 to +70
try {
// Delegate to provider-specific implementation
RocksDB rocksDB = doOpenRocksDB(dbOptions, dataPath, cfDescriptors, cfHandles);

return rocksDB;
} catch (Exception e) {
LOG.error("Failed to open RocksDB with column families using provider: {} at path: {}",
getProviderName(), dataPath, e);
throw e;
}
Comment on lines +84 to +92
try {
// Delegate to provider-specific implementation
RocksDB rocksDB =
doOpenRocksDB(dbOptions, dataPath, cfDescriptors, cfHandles, optionPath,
openHttp);
return rocksDB;
} catch (Exception e) {
throw e;
}
Comment on lines +53 to +54
} catch (Exception e) {
LOG.warn("Standard RocksDB is not available: {}", e.getMessage());
Comment on lines +124 to +132
public void initialize() {
try {
// Load RocksDB native library
RocksDB.loadLibrary();
LOG.debug("Standard RocksDB library loaded successfully");
} catch (Exception e) {
LOG.error("Failed to load standard RocksDB library", e);
throw new RuntimeException("Failed to initialize standard RocksDB provider", e);
}
Comment on lines +131 to +140
// Find provider with highest priority
RocksDBProvider selected = null;
int highestPriority = Integer.MIN_VALUE;

for (RocksDBProvider provider : providerCache.values()) {
if (provider.isAvailable() && provider.getPriority() > highestPriority) {
selected = provider;
highestPriority = provider.getPriority();
}
}
@Value("${grpc.host}")
private String host;

@Value("${rocksdb.option-path: ''}")
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
// Prepare column family names for JSON
List<String> cfNames = new java.util.ArrayList<>();
for (ColumnFamilyDescriptor cfDescriptor : cfDescriptors) {
cfNames.add(new String(cfDescriptor.getName()));
Comment on lines +57 to +90
public synchronized void loadProviders() {
if (loaded) {
return;
}

LOG.info("Loading RocksDB providers via SPI...");

ServiceLoader<RocksDBProvider> serviceLoader = ServiceLoader.load(RocksDBProvider.class);

for (RocksDBProvider provider : serviceLoader) {
try {
if (provider.isAvailable()) {
providerCache.put(provider.getProviderName(), provider);
LOG.info("Loaded RocksDB provider: {} (priority: {})",
provider.getProviderName(), provider.getPriority());
} else {
LOG.warn("RocksDB provider {} is not available in current environment",
provider.getProviderName());
}
} catch (Exception e) {
LOG.error("Failed to load RocksDB provider: {}", provider.getClass().getName(), e);
}
}

if (providerCache.isEmpty()) {
LOG.warn(
"No RocksDB providers found! Make sure providers are properly registered in " +
"META-INF/services");
} else {
LOG.info("Successfully loaded {} RocksDB provider(s): {}",
providerCache.size(), providerCache.keySet());
}

loaded = true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Incompatible dependencies of package feature New feature pd PD module size:XXL This PR changes 1000+ lines, ignoring generated files. store Store module

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

4 participants