fix(server): ensure backend is initialized in gremlin script#2824
fix(server): ensure backend is initialized in gremlin script#2824VGalaxies merged 1 commit intoapache:masterfrom
Conversation
34598e4 to
a23d1d0
Compare
Codecov ReportAttention: Patch coverage is
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. 🚀 New features to boost your workflow:
|
|
@zmrlft Maybe directly modifying https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-dist/src/assembly/static/scripts/example.groovy might be a better idea? I'm not sure if initializing the backend in the constructor could have some potential side effects. cc @imbajin |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
[nitpick] These sequential store open calls and storeProvider.init() could be extracted into a private initBackend() helper to improve readability and avoid constructor bloat.
Yes, what you said makes sense! I will consider it. If the constructor of StandardHugeGraph is modified, it is indeed very likely to cause other problems |
a23d1d0 to
1b19f27
Compare
1b19f27 to
311dd08
Compare
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 addedinitBackendbelow for initializationVerifying these changes
Does this PR potentially affect the following parts?
Documentation Status
Doc - TODODoc - DoneDoc - No Need