feat(rocksdb): support ToplingDB provider#3024
Open
WaterWhisperer wants to merge 53 commits into
Open
Conversation
…th the HG default configuration
# Conflicts: # install-dist/scripts/dependency/known-dependencies.txt
Contributor
There was a problem hiding this comment.
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-providermodule 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_httpconfigs. - 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
hugegraph-rocksdb-providermoduleVerifying these changes
rocksdbjni-8.10.2-SNAPSHOT.jarcontains ToplingDB resources includingorg/rocksdb/SidePluginRepo.classrocksdb.option_pathDoes this PR potentially affect the following parts?
Documentation Status
Doc - TODODoc - DoneDoc - No Need