Skip to content

feat(server): add explicit graph schema clone API - #3439

Merged
imbajin merged 4 commits into
apache:masterfrom
hugegraph:codex/graph-clone-schema
Oct 31, 2026
Merged

imbajin merged 4 commits into
apache:masterfrom
hugegraph:codex/graph-clone-schema

Conversation

@imbajin

@imbajin imbajin commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Before

Configuration cloning does not copy schema, and clients lack a supported schema-clone contract.

After

Add synchronous, same-GraphSpace schema-only cloning and correct copied index IDs and parent-edge ordering. Data is not copied; failures may leave a partial target.

Validation and scope

Author-reported validation is recorded in the source PR; independent dots review and exact-head ASF CI are pending. No live deployment or RC acceptance is claimed. Keep Server #361, Toolchain #121 and Doc #58 paired; the new endpoint is unavailable on older Servers.

Source review: hugegraph/hugegraph#361. This PR uses the same source branch; see that discussion for detailed validation evidence and limitations.

Visual overview

版本纠正:Server 实施目标创建前检查与受支持 Schema 复制。本图仅说明同一 GraphSpace、无边标签源图的配置/属性键/顶点标签及其索引复制;不复制顶点或边数据。有边标签的源图由 Server 在创建目标前拒绝,不表示 SDK 独立保证源图状态。复制期间仍需保持源 Schema 不变,失败可能遗留部分目标,没有自动回滚。API 0.73+ 为能力门槛,不代表该版本已发布或联合验收通过。三仓配套:🔗 Server #3439、🔗 Toolchain #870、🔗 Doc #554。机制示意,不代表 CI、独立实测全覆盖或同一 RC 已通过。评审核对:2026-10-31。

机制示意

@imbajin imbajin left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

[P2] Rebuild inherited parent sort keys instead of copying them at parent creation

A valid base/sub-edge schema with a MULTIPLE child still cannot be cloned. registerInfoToFatherEl() copies the child's sort keys into the existing base label, whose default frequency remains SINGLE. This copy constructor resets the parent's derived links but retains copy.sortKeys(). When SchemaManager.copyFrom() creates the parent first, checkSortKeys() rejects its SINGLE frequency plus nonempty sort keys, so the new schema-clone API fails after creating the target.

Please distinguish child-derived sort keys on a SINGLE parent from valid sort keys explicitly configured on a MULTIPLE parent, preserving the latter, or use a dedicated parent reconstruction path. Add regressions for both parent kinds with a MULTIPLE child, including asBase() plus a withBase(...).multiTimes().properties("time").sortKeys("time") child. The current reversed-order test uses a SINGLE child and does not exercise this case.

Evidence: independent static control-flow review at 2568a1010ead31a3930a92a10998ea3f243b03d9; no live RocksDB/HStore or authenticated request was run in this review.

Source:

@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.93151% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.38%. Comparing base (608cb1d) to head (f512e0c).
⚠️ Report is 24 commits behind head on master.

Files with missing lines Patch % Lines
...che/hugegraph/schema/builder/EdgeLabelBuilder.java 75.00% 1 Missing and 5 partials ⚠️
...va/org/apache/hugegraph/api/profile/GraphsAPI.java 62.50% 0 Missing and 3 partials ⚠️
...n/java/org/apache/hugegraph/core/GraphManager.java 92.59% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3439      +/-   ##
============================================
+ Coverage     57.27%   58.38%   +1.11%     
+ Complexity     6577     3087    -3490     
============================================
  Files           776      779       +3     
  Lines         68881    69393     +512     
  Branches       9431     9567     +136     
============================================
+ Hits          39449    40514    +1065     
+ Misses        25804    25198     -606     
- Partials       3628     3681      +53     
Flag Coverage Δ *Carryforward flag
commons 96.37% <ø> (ø)
hstore 36.05% <0.00%> (-0.04%) ⬇️
pd 56.80% <ø> (+4.64%) ⬆️
server_hbase 42.18% <ø> (+<0.01%) ⬆️ Carriedforward from 351c90b
server_memory 56.48% <84.93%> (+0.50%) ⬆️
server_rocksdb 43.02% <73.97%> (+0.36%) ⬆️
store 35.93% <ø> (+2.78%) ⬆️

*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: yes. Summary: The schema copy fixes in SchemaManager, EdgeLabelBuilder and IndexLabelBuilder run in CoreTestSuite, but no test of the schema-clone endpoint or cloneGraphSchema runs in CI, because GraphSchemaCloneTest and GraphsApiTest belong to no suite.

@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: yes. Summary: The schema-clone endpoint, edge-label preflight and source-ID index fix look correct, but the two new EdgeLabelBuilder tests in GraphSchemaCloneTest fail in the memory-backend unit job, so Server memory tests is red at this head.

builder.singleTime();
builder.ifNotExist();

Assert.assertSame(existed, builder.create());

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.

Important: builder.create() takes the DEFAULT-parent-copy_el_update lock, which no test registers, so this test and testMultiParentCreateIgnoresOnlyDerivedLinks fail with LockGroup 'DEFAULT-parent-copy_el_update' does not exists in the unit-test run. Call LockUtil.init("DEFAULT-parent-copy") before these tests and LockUtil.destroy after, as StandardHugeGraphClearBackendTest does.

@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: schema-clone rejects missing sources, extra options and any source edge label before cloneGraph creates the target, and reports a partial target when a copied element is not CREATED; IndexLabelBuilder resolves the copied base label through the source graph, and parent edge labels drop only derived links and SINGLE-parent sort keys. The earlier suite and lock problems are fixed: GraphSchemaCloneTest runs in UnitTestSuite, the endpoint tests run in GraphsApiStandaloneTest, and the memory, RocksDB and HStore jobs pass at this head.

@imbajin imbajin changed the title fix(server): add explicit graph schema clone API feat(server): add explicit graph schema clone API Oct 31, 2026
@imbajin
imbajin merged commit 0e9f257 into apache:master Oct 31, 2026
19 checks passed
@imbajin
imbajin deleted the codex/graph-clone-schema branch October 31, 2026 17:54
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