Skip to content

refactor(server): use typed graph registry keys - #3482

Open
iiiiSaber wants to merge 1 commit into
apache:masterfrom
iiiiSaber:refactor/graph-manager-key
Open

iiiiSaber wants to merge 1 commit into
apache:masterfrom
iiiiSaber:refactor/graph-manager-key

Conversation

@iiiiSaber

@iiiiSaber iiiiSaber commented Nov 17, 2026 •

Copy link
Copy Markdown

Purpose of the PR

Address the GraphManager FIXME by replacing combined string keys with typed graph identities.

In GraphManager there is a comment to ask for fix:

    //FIXME: add one class like graphKey as key,which contains graphSpace and graphName
    private final Map<String, Graph> graphs;
    private final Set<String> localGraphs;
    private final Set<String> removingGraphs;
    ...

Main Changes

  • Introduce the immutable GraphKey record.
public record GraphKey(String graphSpace, String graphName) {

    public GraphKey {
        Objects.requireNonNull(graphSpace, "graphSpace");
        Objects.requireNonNull(graphName, "graphName");
    }
    ...
}
    private final Map<GraphKey, Graph> graphs;
    private final Set<GraphKey> localGraphs;
    private final Set<GraphKey> removingGraphs;
    ...
  • Use typed keys for registry and lifecycle tracking.
  • Preserve string interfaces and the live graph-name view.
  • Add regression tests and update existing fixtures.

Verifying these changes

  • Trivial rework / code cleanup without any test coverage. (No Need)
  • Already covered by existing tests.
  • Need tests and can be verified as follows:

128 focused tests passed, including four new regression tests. Formatting, full clean compilation, and git diff --check passed.

Does this PR potentially affect the following parts?

  • Dependencies
  • Modify configurations
  • The public API
  • Other affects: internal graph registry and lifecycle tracking.
  • Nope

Documentation Status

  • Doc - TODO
  • Doc - Done
  • Doc - No Need: internal refactor.

- Introduce GraphKey for graph-space and graph-name identity.
- Migrate registry and lifecycle tracking to typed keys.
- Preserve string boundaries and the live graph-name view.
- Add registry regressions and adapt existing lifecycle fixtures.
@codecov

codecov Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 69.23077% with 36 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.54%. Comparing base (8828d82) to head (f9523ab).

Files with missing lines Patch % Lines
...n/java/org/apache/hugegraph/core/GraphManager.java 66.35% 19 Missing and 17 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3482      +/-   ##
============================================
+ Coverage     58.52%   58.54%   +0.01%     
- Complexity     2717     3096     +379     
============================================
  Files           779      780       +1     
  Lines         69439    69458      +19     
  Branches       9577     9582       +5     
============================================
+ Hits          40637    40662      +25     
+ Misses        25108    25099       -9     
- Partials       3694     3697       +3     
Flag Coverage Δ *Carryforward flag
commons 96.37% <ø> (ø) Carriedforward from 8828d82
hstore 36.24% <33.33%> (+0.02%) ⬆️
pd 56.83% <ø> (ø) Carriedforward from 8828d82
server_hbase 42.54% <ø> (+0.05%) ⬆️ Carriedforward from 8828d82
server_memory 56.67% <69.23%> (+0.02%) ⬆️
server_rocksdb 43.01% <22.22%> (+<0.01%) ⬆️
store 36.20% <ø> (ø) Carriedforward from 8828d82

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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.

@bitflicker64 bitflicker64 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Blocking: no. Score: 9/10. Summary: GraphKey replaces every string registry key in GraphManager with matching behaviour under the graph and graph space naming rules, and the 128 focused GraphManager unit tests pass at this head.

@imbajin imbajin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Score: 8.2/10 · Confidence: medium

Blocking: no

Summary

No new actionable regression confirmed in the typed graph registry conversion.

Evidence

Traced registry creation, lookup, removal and reload, the live names view, metadata string boundaries, and graph-name validation. The latter excludes the delimiter from graph names.

Validation notes

Live PD events and multi-node lifecycle behavior were not independently tested. An older event parser still splits hyphenated graph-space names; an introduced regression was not established. Approval is withheld pending those integration checks.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants