fix(server): ensure backend is initialized in gremlin script by zmrlft · Pull Request #2824 · apache/hugegraph
Purpose of the PR
Main Changes
The fundamental reason is that HugeFactory.open () returns an instance of StandardHugeGraph, but its backend storage has not been initialized yet. I added initBackend below for initialization
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:
- xxx
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)
- Nope
Documentation Status
-
Doc - TODO -
Doc - Done -
Doc - No Need
labels
Jun 29, 2025Codecov Report
Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
Project coverage is 0.08%. Comparing base (
e139465) to head (a23d1d0).
| Files with missing lines | Patch % | Lines |
|---|---|---|
| ...n/java/org/apache/hugegraph/StandardHugeGraph.java | 0.00% | 4 Missing ⚠️ |
❗ There is a different number of reports uploaded between BASE (e139465) and HEAD (a23d1d0). Click for more details.
Additional details and impacted files
@@ Coverage Diff @@ ## master #2824 +/- ## ============================================ - Coverage 42.87% 0.08% -42.79% + Complexity 458 22 -436 ============================================ Files 758 725 -33 Lines 61313 57652 -3661 Branches 7877 7232 -645 ============================================ - Hits 26286 51 -26235 - Misses 32311 57599 +25288 + Partials 2716 2 -2714
☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.
🚀 New features to boost your workflow:
- ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR ensures that the backend stores are initialized when a StandardHugeGraph instance is created by calling each store’s open(...) and the storeProvider.init() in the constructor.
- Added explicit calls to open schema, system, and graph stores
- Initialized the
storeProviderimmediately after store opens
Comments suppressed due to low confidence (1)
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/StandardHugeGraph.java:249
- Consider adding a unit test that constructs
StandardHugeGraphand verifies the stores are open andstoreProvideris initialized to prevent regressions.
this.loadSchemaStore().open(this.configuration);
|
|
||
| try { | ||
|
|
||
| this.loadSchemaStore().open(this.configuration); |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] These sequential store open calls and storeProvider.init() could be extracted into a private initBackend() helper to improve readability and avoid constructor bloat.
Copilot uses AI. Check for mistakes.
zmrlft
changed the title
fix(server): ensure backend is initialized in StandardHugeGraph const…
fix(server): ensure backend is initialized in gremlin script
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THX~
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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